<s>
This	O
Comparison	B-Data_Structure
of	I-Data_Structure
programming	I-Data_Structure
languages	I-Data_Structure
(	O
associative	B-Application
arrays	I-Application
)	O
compares	O
the	O
features	O
of	O
associative	B-Application
array	I-Application
data	B-General_Concept
structures	I-General_Concept
or	O
array-lookup	O
processing	O
for	O
over	O
40	O
computer	O
programming	O
languages	O
.	O
</s>
<s>
The	O
following	O
is	O
a	O
comparison	O
of	O
associative	B-Application
arrays	I-Application
(	O
also	O
"	O
mapping	O
"	O
,	O
"	O
hash	O
"	O
,	O
and	O
"	O
dictionary	B-Application
"	O
)	O
in	O
various	O
programming	O
languages	O
.	O
</s>
<s>
Awk	B-Application
has	O
built-in	O
,	O
language-level	O
support	O
for	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
The	O
user	O
can	O
search	O
for	O
elements	O
in	O
an	O
associative	B-Application
array	I-Application
,	O
and	O
delete	O
elements	O
from	O
the	O
array	O
.	O
</s>
<s>
The	O
following	O
shows	O
how	O
multi-dimensional	O
associative	B-Application
arrays	I-Application
can	O
be	O
simulated	O
in	O
standard	O
Awk	B-Application
using	O
concatenation	O
and	O
the	O
built-in	O
string-separator	O
variable	O
SUBSEP	O
:	O
</s>
<s>
There	O
is	O
no	O
standard	O
implementation	O
of	O
associative	B-Application
arrays	I-Application
in	O
C	B-Language
,	O
but	O
a	O
3rd-party	O
library	O
,	O
C	B-Application
Hash	I-Application
Table	O
,	O
with	O
BSD	O
license	O
,	O
is	O
available	O
.	O
</s>
<s>
Another	O
3rd-party	O
library	O
,	O
uthash	O
,	O
also	O
creates	O
associative	B-Application
arrays	I-Application
from	O
C	B-Language
structures	O
.	O
</s>
<s>
Finally	O
,	O
the	O
GLib	B-Language
library	O
also	O
supports	O
associative	B-Application
arrays	I-Application
,	O
along	O
with	O
many	O
other	O
advanced	O
data	O
types	O
and	O
is	O
the	O
recommended	O
implementation	O
of	O
the	O
GNU	O
Project	O
.	O
</s>
<s>
Similar	O
to	O
GLib	B-Language
,	O
Apple	O
's	O
cross-platform	O
Core	B-Operating_System
Foundation	I-Operating_System
framework	O
provides	O
several	O
basic	O
data	O
types	O
.	O
</s>
<s>
C#	B-Application
uses	O
the	O
collection	O
classes	O
provided	O
by	O
the	O
.NET	B-Application
Framework	I-Application
.	O
</s>
<s>
The	O
most	O
commonly	O
used	O
associative	B-Application
array	I-Application
type	O
is	O
System.Collections.Generic.Dictionaryxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
,	O
which	O
is	O
implemented	O
as	O
a	O
mutable	B-Application
hash	B-Algorithm
table	I-Algorithm
.	O
</s>
<s>
The	O
relatively	O
new	O
System.Collections.Immutable	O
package	O
,	O
available	O
in	O
.NET	B-Application
Framework	I-Application
versions	O
4.5	O
and	O
above	O
,	O
and	O
in	O
all	O
versions	O
of	O
.NET	B-Application
Core	I-Application
,	O
also	O
includes	O
the	O
System.Collections.Immutable.Dictionaryxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
type	O
,	O
which	O
is	O
implemented	O
using	O
an	O
AVL	O
tree	O
.	O
</s>
<s>
The	O
following	O
demonstrates	O
three	O
means	O
of	O
populating	O
a	O
mutable	B-Application
dictionary	B-Application
:	O
</s>
<s>
the	O
Add	O
method	O
,	O
which	O
adds	O
a	O
key	O
and	O
value	O
and	O
throws	O
an	O
exception	B-General_Concept
if	O
the	O
key	O
already	O
exists	O
in	O
the	O
dictionary	B-Application
;	O
</s>
<s>
assigning	O
to	O
the	O
backing	O
property	O
of	O
the	O
indexer	O
,	O
for	O
which	O
the	O
indexer	O
is	O
syntactic	O
sugar	O
(	O
not	O
applicable	O
to	O
C#	B-Application
,	O
see	O
F#	B-Operating_System
or	O
VB.NET	B-Language
examples	O
)	O
.	O
</s>
<s>
The	O
dictionary	B-Application
can	O
also	O
be	O
initialized	O
during	O
construction	O
using	O
a	O
"	O
collection	O
initializer	O
"	O
,	O
which	O
compiles	O
to	O
repeated	O
calls	O
to	O
Add	O
.	O
</s>
<s>
Values	O
are	O
primarily	O
retrieved	O
using	O
the	O
indexer	O
(	O
which	O
throws	O
an	O
exception	B-General_Concept
if	O
the	O
key	O
does	O
not	O
exist	O
)	O
and	O
the	O
TryGetValue	O
method	O
,	O
which	O
has	O
an	O
output	O
parameter	O
for	O
the	O
sought	O
value	O
and	O
a	O
Boolean	O
return-value	O
indicating	O
whether	O
the	O
key	O
was	O
found	O
.	O
</s>
<s>
A	O
dictionary	B-Application
can	O
be	O
viewed	O
as	O
a	O
sequence	O
of	O
keys	O
,	O
sequence	O
of	O
values	O
,	O
or	O
sequence	O
of	O
pairs	O
of	O
keys	O
and	O
values	O
represented	O
by	O
instances	O
of	O
the	O
KeyValuePairxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
type	O
,	O
although	O
there	O
is	O
no	O
guarantee	O
of	O
order	O
.	O
</s>
<s>
For	O
a	O
sorted	O
dictionary	B-Application
,	O
the	O
programmer	O
could	O
choose	O
to	O
use	O
a	O
SortedDictionaryxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
or	O
use	O
the	O
.Sort	O
LINQ	B-Language
extension	O
method	O
when	O
enumerating	O
.	O
</s>
<s>
C++	B-Language
has	O
a	O
form	O
of	O
associative	B-Application
array	I-Application
called	O
std::map	B-Language
(	O
see	O
Standard	B-Application
Template	I-Application
Library	I-Application
#Containers	O
)	O
.	O
</s>
<s>
One	O
could	O
create	O
a	O
phone-book	O
map	O
with	O
the	O
following	O
code	O
in	O
C++	B-Language
:	O
</s>
<s>
With	O
the	O
extension	O
of	O
initialization	O
lists	O
in	O
C++11	O
,	O
entries	O
can	O
be	O
added	O
during	O
a	O
map	O
's	O
construction	O
as	O
shown	O
below	O
:	O
</s>
<s>
You	O
can	O
iterate	O
through	O
the	O
list	O
with	O
the	O
following	O
code	O
(	O
C++03	O
)	O
:	O
</s>
<s>
The	O
same	O
task	O
in	O
C++11	O
:	O
</s>
<s>
Using	O
the	O
structured	O
binding	O
available	O
in	O
C++17	B-Language
:	O
</s>
<s>
In	O
C++	B-Language
,	O
the	O
std::map	B-Language
class	O
is	O
templated	O
which	O
allows	O
the	O
data	O
types	O
of	O
keys	O
and	O
values	O
to	O
be	O
different	O
for	O
different	O
map	O
instances	O
.	O
</s>
<s>
Although	O
std::map	B-Language
is	O
typically	O
implemented	O
using	O
a	O
self-balancing	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
,	O
C++11	O
defines	O
a	O
second	O
map	O
called	O
std::unordered_map	O
,	O
which	O
has	O
the	O
algorithmic	O
characteristics	O
of	O
a	O
hash	B-Algorithm
table	I-Algorithm
.	O
</s>
<s>
This	O
is	O
a	O
common	O
vendor	O
extension	O
to	O
the	O
Standard	B-Application
Template	I-Application
Library	I-Application
(	O
STL	O
)	O
as	O
well	O
,	O
usually	O
called	O
hash_map	O
,	O
available	O
from	O
such	O
implementations	O
as	O
SGI	O
and	O
STLPort	B-Application
.	O
</s>
<s>
A	O
structure	O
in	O
CFML	B-Language
is	O
equivalent	O
to	O
an	O
associative	B-Application
array	I-Application
:	O
</s>
<s>
Initializing	O
an	O
empty	O
dictionary	B-Application
and	O
adding	O
items	O
in	O
Cobra	B-Language
:	O
</s>
<s>
Alternatively	O
,	O
a	O
dictionary	B-Application
can	O
be	O
initialized	O
with	O
all	O
items	O
during	O
construction	O
:	O
</s>
<s>
The	O
dictionary	B-Application
can	O
be	O
enumerated	O
by	O
a	O
for-loop	O
,	O
but	O
there	O
is	O
no	O
guaranteed	O
order	O
:	O
</s>
<s>
D	B-Application
offers	O
direct	O
support	O
for	O
associative	B-Application
arrays	I-Application
in	O
the	O
core	O
language	O
;	O
such	O
arrays	O
are	O
implemented	O
as	O
a	O
chaining	O
hash	B-Algorithm
table	I-Algorithm
with	O
binary	O
trees	O
.	O
</s>
<s>
Keys	O
and	O
values	O
can	O
be	O
any	O
types	O
,	O
but	O
all	O
the	O
keys	O
in	O
an	O
associative	B-Application
array	I-Application
must	O
be	O
of	O
the	O
same	O
type	O
,	O
and	O
the	O
same	O
goes	O
for	O
dependent	O
values	O
.	O
</s>
<s>
Delphi	B-Language
supports	O
several	O
standard	O
containers	O
,	O
including	O
TDictionaryxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
:	O
</s>
<s>
Versions	O
of	O
Delphi	B-Language
prior	O
to	O
2009	O
do	O
not	O
offer	O
direct	O
support	O
for	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
However	O
,	O
associative	B-Application
arrays	I-Application
can	O
be	O
simulated	O
using	O
the	O
TStrings	O
class	O
:	O
</s>
<s>
Erlang	B-Operating_System
offers	O
many	O
ways	O
to	O
represent	O
mappings	O
;	O
three	O
of	O
the	O
most	O
common	O
in	O
the	O
standard	O
library	O
are	O
keylists	O
,	O
dictionaries	B-Application
,	O
and	O
maps	O
.	O
</s>
<s>
Keylists	O
are	O
lists	O
of	O
tuples	B-Application
,	O
where	O
the	O
first	O
element	O
of	O
each	O
tuple	B-Application
is	O
a	O
key	O
,	O
and	O
the	O
second	O
is	O
a	O
value	O
.	O
</s>
<s>
Dictionaries	B-Application
are	O
implemented	O
in	O
the	O
dict	O
module	O
of	O
the	O
standard	O
library	O
.	O
</s>
<s>
A	O
new	O
dictionary	B-Application
is	O
created	O
using	O
the	O
dict:new/0	O
function	O
and	O
new	O
key/value	O
pairs	O
are	O
stored	O
using	O
the	O
dict:store/3	O
function	O
:	O
</s>
<s>
Such	O
a	O
serial	O
initialization	O
would	O
be	O
more	O
idiomatically	O
represented	O
in	O
Erlang	B-Operating_System
with	O
the	O
appropriate	O
function	O
:	O
</s>
<s>
The	O
dictionary	B-Application
can	O
be	O
accessed	O
using	O
the	O
dict:find/2	O
function	O
:	O
</s>
<s>
In	O
both	O
cases	O
,	O
any	O
Erlang	B-Operating_System
term	O
can	O
be	O
used	O
as	O
the	O
key	O
.	O
</s>
<s>
Variations	O
include	O
the	O
orddict	O
module	O
,	O
implementing	O
ordered	O
dictionaries	B-Application
,	O
and	O
gb_trees	O
,	O
implementing	O
general	O
balanced	B-Data_Structure
trees	I-Data_Structure
.	O
</s>
<s>
Maps	O
were	O
introduced	O
in	O
OTP	O
17.0	O
,	O
and	O
combine	O
the	O
strengths	O
of	O
keylists	O
and	O
dictionaries	B-Application
.	O
</s>
<s>
Unlike	O
dictionaries	B-Application
,	O
maps	O
can	O
be	O
pattern	O
matched	O
upon	O
:	O
</s>
<s>
Erlang	B-Operating_System
also	O
provides	O
syntax	O
sugar	O
for	O
functional	O
updates	O
—	O
creating	O
a	O
new	O
map	O
based	O
on	O
an	O
existing	O
one	O
,	O
but	O
with	O
modified	O
values	O
or	O
additional	O
keys	O
:	O
</s>
<s>
At	O
runtime	O
,	O
F#	B-Operating_System
provides	O
the	O
Collections.Mapxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
type	O
,	O
which	O
is	O
an	O
immutable	B-Application
AVL	O
tree	O
.	O
</s>
<s>
The	O
following	O
example	O
calls	O
the	O
Map	O
constructor	O
,	O
which	O
operates	O
on	O
a	O
list	O
(	O
a	O
semicolon	O
delimited	O
sequence	O
of	O
elements	O
enclosed	O
in	O
square	O
brackets	O
)	O
of	O
tuples	B-Application
(	O
which	O
in	O
F#	B-Operating_System
are	O
comma-delimited	O
sequences	O
of	O
elements	O
)	O
.	O
</s>
<s>
Values	O
can	O
be	O
looked	O
up	O
via	O
one	O
of	O
the	O
Map	O
members	O
,	O
such	O
as	O
its	O
indexer	O
or	O
Item	O
property	O
(	O
which	O
throw	O
an	O
exception	B-General_Concept
if	O
the	O
key	O
does	O
not	O
exist	O
)	O
or	O
the	O
TryFind	O
function	O
,	O
which	O
returns	O
an	O
option	O
type	O
with	O
a	O
value	O
of	O
Some	O
<result>	O
,	O
for	O
a	O
successful	O
lookup	O
,	O
or	O
None	O
,	O
for	O
an	O
unsuccessful	O
one	O
.	O
</s>
<s>
Pattern	B-Language
matching	I-Language
can	O
then	O
be	O
used	O
to	O
extract	O
the	O
raw	O
value	O
from	O
the	O
result	O
,	O
or	O
a	O
default	O
value	O
can	O
be	O
set	O
.	O
</s>
<s>
Because	O
F#	B-Operating_System
is	O
a	O
.NET	B-Application
language	O
,	O
it	O
also	O
has	O
access	O
to	O
features	O
of	O
the	O
.NET	B-Application
Framework	I-Application
,	O
including	O
the	O
type	O
(	O
which	O
is	O
implemented	O
as	O
a	O
hash	B-Algorithm
table	I-Algorithm
)	O
,	O
which	O
is	O
the	O
primary	O
associative	B-Application
array	I-Application
type	O
used	O
in	O
C#	B-Application
and	O
Visual	B-Language
Basic	I-Language
.	O
</s>
<s>
This	O
type	O
may	O
be	O
preferred	O
when	O
writing	O
code	O
that	O
is	O
intended	O
to	O
operate	O
with	O
other	O
languages	O
on	O
the	O
.NET	B-Application
Framework	I-Application
,	O
or	O
when	O
the	O
performance	O
characteristics	O
of	O
a	O
hash	B-Algorithm
table	I-Algorithm
are	O
preferred	O
over	O
those	O
of	O
an	O
AVL	O
tree	O
.	O
</s>
<s>
The	O
dict	O
function	O
provides	O
a	O
means	O
of	O
conveniently	O
creating	O
a	O
.NET	B-Application
dictionary	B-Application
that	O
is	O
not	O
intended	O
to	O
be	O
mutated	O
;	O
it	O
accepts	O
a	O
sequence	O
of	O
tuples	B-Application
and	O
returns	O
an	O
immutable	B-Application
object	I-Application
that	O
implements	O
IDictionaryxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
.	O
</s>
<s>
When	O
a	O
mutable	B-Application
dictionary	B-Application
is	O
needed	O
,	O
the	O
constructor	O
of	O
can	O
be	O
called	O
directly	O
.	O
</s>
<s>
See	O
the	O
C#	B-Application
example	O
on	O
this	O
page	O
for	O
additional	O
information	O
.	O
</s>
<s>
F#	B-Operating_System
also	O
allows	O
the	O
function	O
to	O
be	O
called	O
as	O
if	O
it	O
had	O
no	O
output	O
parameter	O
and	O
instead	O
returned	O
a	O
tuple	B-Application
containing	O
its	O
regular	O
return	O
value	O
and	O
the	O
value	O
assigned	O
to	O
the	O
output	O
parameter	O
:	O
</s>
<s>
A	O
dictionary	B-Application
or	O
map	O
can	O
be	O
enumerated	O
using	O
Seq.map	O
.	O
</s>
<s>
Visual	B-Application
FoxPro	I-Application
implements	O
mapping	O
with	O
the	O
Collection	O
Class	O
.	O
</s>
<s>
Go	B-Application
has	O
built-in	O
,	O
language-level	O
support	O
for	O
associative	B-Application
arrays	I-Application
,	O
called	O
"	O
maps	O
"	O
.	O
</s>
<s>
A	O
map	O
's	O
key	O
type	O
may	O
only	O
be	O
a	O
boolean	O
,	O
numeric	O
,	O
string	O
,	O
array	O
,	O
struct	B-Application
,	O
pointer	O
,	O
interface	O
,	O
or	O
channel	O
type	O
.	O
</s>
<s>
The	O
Haskell	B-Language
programming	I-Language
language	I-Language
provides	O
only	O
one	O
kind	O
of	O
associative	B-Application
container	I-Application
–	O
a	O
list	O
of	O
pairs	O
:	O
</s>
<s>
GHC	B-Application
,	O
the	O
most	O
commonly	O
used	O
implementation	O
of	O
Haskell	B-Language
,	O
provides	O
two	O
more	O
types	O
of	O
associative	B-Language
containers	I-Language
.	O
</s>
<s>
One	O
is	O
polymorphic	O
functional	O
maps	O
(	O
represented	O
as	O
immutable	B-Application
balanced	B-Data_Structure
binary	I-Data_Structure
trees	I-Data_Structure
)	O
:	O
</s>
<s>
Finally	O
,	O
a	O
polymorphic	O
hash	B-Algorithm
table	I-Algorithm
:	O
</s>
<s>
Lists	O
of	O
pairs	O
and	O
functional	O
maps	O
both	O
provide	O
a	O
purely	O
functional	O
interface	O
,	O
which	O
is	O
more	O
idiomatic	O
in	O
Haskell	B-Language
.	O
</s>
<s>
In	O
contrast	O
,	O
hash	B-Algorithm
tables	I-Algorithm
provide	O
an	O
imperative	O
interface	O
in	O
the	O
IO	O
monad	O
.	O
</s>
<s>
In	O
Java	B-Language
associative	B-Application
arrays	I-Application
are	O
implemented	O
as	O
"	O
maps	O
"	O
,	O
which	O
are	O
part	O
of	O
the	O
Java	B-Language
collections	I-Language
framework	I-Language
.	O
</s>
<s>
Since	O
J2SE	B-Language
5.0	O
and	O
the	O
introduction	O
of	O
generics	B-Language
into	O
Java	B-Language
,	O
collections	O
can	O
have	O
a	O
type	O
specified	O
;	O
for	O
example	O
,	O
an	O
associative	B-Application
array	I-Application
that	O
maps	O
strings	O
to	O
strings	O
might	O
be	O
specified	O
as	O
follows	O
:	O
</s>
<s>
This	O
code	O
uses	O
a	O
hash	B-Algorithm
map	I-Algorithm
to	O
store	O
the	O
associative	B-Application
array	I-Application
,	O
by	O
calling	O
the	O
constructor	O
of	O
the	O
class	O
.	O
</s>
<s>
However	O
,	O
since	O
the	O
code	O
only	O
uses	O
methods	O
common	O
to	O
the	O
interface	O
,	O
a	O
self-balancing	B-Data_Structure
binary	I-Data_Structure
tree	I-Data_Structure
could	O
be	O
used	O
by	O
calling	O
the	O
constructor	O
of	O
the	O
class	O
(	O
which	O
implements	O
the	O
subinterface	O
)	O
,	O
without	O
changing	O
the	O
definition	O
of	O
the	O
phoneBook	O
variable	O
,	O
or	O
the	O
rest	O
of	O
the	O
code	O
,	O
or	O
using	O
other	O
underlying	O
data	B-General_Concept
structures	I-General_Concept
that	O
implement	O
the	O
Map	O
interface	O
.	O
</s>
<s>
The	O
hash	O
function	O
in	O
Java	B-Language
,	O
used	O
by	O
HashMap	B-Algorithm
and	O
HashSet	O
,	O
is	O
provided	O
by	O
the	O
method	O
.	O
</s>
<s>
Since	O
every	O
class	O
in	O
Java	B-Language
inherits	B-Language
from	O
,	O
every	O
object	O
has	O
a	O
hash	O
function	O
.	O
</s>
<s>
A	O
class	O
can	O
override	B-Language
the	O
default	O
implementation	O
of	O
hashCode( )	O
to	O
provide	O
a	O
custom	O
hash	O
function	O
more	O
in	O
accordance	O
with	O
the	O
properties	O
of	O
the	O
object	O
.	O
</s>
<s>
Hashed	O
data	B-General_Concept
structures	I-General_Concept
in	O
Java	B-Language
rely	O
on	O
objects	O
maintaining	O
the	O
following	O
contract	O
between	O
their	O
hashCode( )	O
and	O
equals( )	O
methods	O
:	O
</s>
<s>
In	O
order	O
to	O
maintain	O
this	O
contract	O
,	O
a	O
class	O
that	O
overrides	B-Language
equals( )	O
must	O
also	O
override	B-Language
hashCode( )	O
,	O
and	O
vice	O
versa	O
,	O
so	O
that	O
hashCode( )	O
is	O
based	O
on	O
the	O
same	O
properties	O
(	O
or	O
a	O
subset	O
of	O
the	O
properties	O
)	O
as	O
equals( )	O
.	O
</s>
<s>
A	O
further	O
contract	O
that	O
a	O
hashed	O
data	B-General_Concept
structure	I-General_Concept
has	O
with	O
the	O
object	O
is	O
that	O
the	O
results	O
of	O
the	O
hashCode( )	O
and	O
equals( )	O
methods	O
will	O
not	O
change	O
once	O
the	O
object	O
has	O
been	O
inserted	O
into	O
the	O
map	O
.	O
</s>
<s>
For	O
this	O
reason	O
,	O
it	O
is	O
generally	O
a	O
good	O
practice	O
to	O
base	O
the	O
hash	O
function	O
on	O
immutable	B-Application
properties	O
of	O
the	O
object	O
.	O
</s>
<s>
Analogously	O
,	O
TreeMap	O
,	O
and	O
other	O
sorted	O
data	B-General_Concept
structures	I-General_Concept
,	O
require	O
that	O
an	O
ordering	O
be	O
defined	O
on	O
the	O
data	O
type	O
.	O
</s>
<s>
As	O
with	O
HashMap	B-Algorithm
above	O
,	O
the	O
relative	O
ordering	O
of	O
keys	O
in	O
a	O
TreeMap	O
should	O
not	O
change	O
once	O
they	O
have	O
been	O
inserted	O
into	O
the	O
map	O
.	O
</s>
<s>
JavaScript	B-Language
(	O
and	O
its	O
standardized	O
version	O
,	O
ECMAScript	B-Language
)	O
is	O
a	O
prototype-based	B-Application
object-oriented	B-Language
language	I-Language
.	O
</s>
<s>
Modern	O
JavaScript	B-Language
handles	O
associative	B-Application
arrays	I-Application
,	O
using	O
the	O
Map	O
and	O
WeakMap	O
classes	O
.	O
</s>
<s>
In	O
JavaScript	B-Language
an	O
object	O
is	O
a	O
mapping	O
from	O
property	O
names	O
to	O
values	O
—	O
that	O
is	O
,	O
an	O
associative	B-Application
array	I-Application
with	O
one	O
caveat	O
:	O
the	O
keys	O
of	O
an	O
object	O
must	O
be	O
either	O
a	O
string	O
or	O
a	O
symbol	O
(	O
native	O
objects	O
and	O
primitives	O
implicitly	O
converted	O
to	O
a	O
string	O
keys	O
are	O
allowed	O
)	O
.	O
</s>
<s>
Objects	O
also	O
include	O
one	O
feature	O
unrelated	O
to	O
associative	B-Application
arrays	I-Application
:	O
an	O
object	O
has	O
a	O
prototype	O
,	O
so	O
it	O
contains	O
default	O
keys	O
that	O
could	O
conflict	O
with	O
user-defined	O
keys	O
.	O
</s>
<s>
As	O
of	O
ECMAScript	B-Language
5	O
(	O
ES5	O
)	O
,	O
the	O
prototype	O
can	O
also	O
be	O
bypassed	O
by	O
using	O
Object.create(null )	O
:	O
</s>
<s>
Lookup	O
is	O
written	O
using	O
property-access	O
notation	O
,	O
either	O
square	O
brackets	O
,	O
which	O
always	O
work	O
,	O
or	O
dot	B-Language
notation	I-Language
,	O
which	O
only	O
works	O
for	O
identifier	O
keys	O
:	O
</s>
<s>
In	O
modern	O
JavaScript	B-Language
it	O
's	O
considered	O
bad	O
form	O
to	O
use	O
the	O
Array	O
type	O
as	O
an	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
This	O
issue	O
has	O
been	O
brought	O
to	O
the	O
fore	O
by	O
the	O
popularity	O
of	O
JavaScript	B-Language
frameworks	O
that	O
make	O
heavy	O
and	O
sometimes	O
indiscriminate	O
use	O
of	O
prototypes	O
to	O
extend	O
JavaScript	B-Language
's	O
inbuilt	O
types	O
.	O
</s>
<s>
In	O
Julia	B-Application
,	O
the	O
following	O
operations	O
manage	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
Declare	O
dictionary	B-Application
:	O
</s>
<s>
In	O
KornShell	B-Language
93	O
,	O
and	O
compliant	O
shells	O
(	O
ksh93	B-Language
,	O
bash4	O
...	O
)	O
,	O
the	O
following	O
operations	O
can	O
be	O
used	O
with	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
Lisp	B-Language
was	O
originally	O
conceived	O
as	O
a	O
"	O
LISt	B-Language
Processing	I-Language
"	O
language	O
,	O
and	O
one	O
of	O
its	O
most	O
important	O
data	O
types	O
is	O
the	O
linked	O
list	O
,	O
which	O
can	O
be	O
treated	O
as	O
an	O
association	B-Data_Structure
list	I-Data_Structure
(	O
"	O
alist	O
"	O
)	O
.	O
</s>
<s>
Lisp	B-Language
and	O
Scheme	B-Language
provide	O
operators	O
such	O
as	O
assoc	O
to	O
manipulate	O
alists	O
in	O
ways	O
similar	O
to	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
A	O
set	O
of	O
operations	O
specific	O
to	O
the	O
handling	O
of	O
association	B-Data_Structure
lists	I-Data_Structure
exists	O
for	O
Common	B-Language
Lisp	I-Language
,	O
each	O
of	O
these	O
working	O
non-destructively	O
.	O
</s>
<s>
To	O
add	O
an	O
entry	O
the	O
acons	O
function	O
is	O
employed	O
,	O
creating	O
and	O
returning	O
a	O
new	O
association	B-Data_Structure
list	I-Data_Structure
.	O
</s>
<s>
An	O
association	B-Data_Structure
list	I-Data_Structure
in	O
Common	B-Language
Lisp	I-Language
mimicks	O
a	O
stack	O
,	O
that	O
is	O
,	O
adheres	O
to	O
the	O
last-in-first-out	O
(	O
LIFO	O
)	O
principle	O
,	O
and	O
hence	O
prepends	O
to	O
the	O
list	O
head	O
.	O
</s>
<s>
This	O
function	O
can	O
be	O
construed	O
as	O
an	O
accommodation	O
for	O
cons	B-Protocol
operations	O
.	O
</s>
<s>
Of	O
course	O
,	O
the	O
destructive	O
push	O
operation	O
also	O
allows	O
inserting	O
entries	O
into	O
an	O
association	B-Data_Structure
list	I-Data_Structure
,	O
an	O
entry	O
having	O
to	O
constitute	O
a	O
key-value	O
cons	B-Protocol
in	O
order	O
to	O
retain	O
the	O
mapping	O
's	O
validity	O
.	O
</s>
<s>
Searching	O
for	O
an	O
entry	O
by	O
its	O
key	O
is	O
performed	O
via	O
assoc	O
,	O
which	O
might	O
be	O
configured	O
for	O
the	O
test	O
predicate	O
and	O
direction	O
,	O
especially	O
searching	O
the	O
association	B-Data_Structure
list	I-Data_Structure
from	O
its	O
end	O
to	O
its	O
front	O
.	O
</s>
<s>
The	O
result	O
,	O
if	O
positive	O
,	O
returns	O
the	O
entire	O
entry	O
cons	B-Protocol
,	O
not	O
only	O
its	O
value	O
.	O
</s>
<s>
Common	B-Language
Lisp	I-Language
also	O
supports	O
a	O
hash	B-Algorithm
table	I-Algorithm
data	O
type	O
,	O
and	O
for	O
Scheme	B-Language
they	O
are	O
implemented	O
in	O
SRFI	B-Language
69	O
.	O
</s>
<s>
Hash	B-Algorithm
tables	I-Algorithm
have	O
greater	O
overhead	O
than	O
alists	O
,	O
but	O
provide	O
much	O
faster	O
access	O
when	O
there	O
are	O
many	O
elements	O
.	O
</s>
<s>
A	O
further	O
characteristic	O
is	O
the	O
fact	O
that	O
Common	B-Language
Lisp	I-Language
hash	B-Algorithm
tables	I-Algorithm
do	O
not	O
,	O
as	O
opposed	O
to	O
association	B-Data_Structure
lists	I-Data_Structure
,	O
maintain	O
the	O
order	O
of	O
entry	O
insertion	O
.	O
</s>
<s>
Common	B-Language
Lisp	I-Language
hash	B-Algorithm
tables	I-Algorithm
are	O
constructed	O
via	O
the	O
make-hash-table	O
function	O
,	O
whose	O
arguments	O
encompass	O
,	O
among	O
other	O
configurations	O
,	O
a	O
predicate	O
to	O
test	O
the	O
entry	O
key	O
.	O
</s>
<s>
While	O
tolerating	O
arbitrary	O
objects	O
,	O
even	O
heterogeneity	O
within	O
a	O
single	O
hash	B-Algorithm
table	I-Algorithm
instance	O
,	O
the	O
specification	O
of	O
this	O
key	O
:test	O
function	O
is	O
confined	O
to	O
distinguishable	O
entities	O
:	O
the	O
Common	B-Language
Lisp	I-Language
standard	O
only	O
mandates	O
the	O
support	O
of	O
eq	O
,	O
eql	O
,	O
equal	O
,	O
and	O
equalp	O
,	O
yet	O
designating	O
additional	O
or	O
custom	O
operations	O
as	O
permissive	O
for	O
concrete	O
implementations	O
.	O
</s>
<s>
An	O
invocation	O
of	O
gethash	O
actually	O
returns	O
two	O
values	O
:	O
the	O
value	O
or	O
substitute	O
value	O
for	O
the	O
key	O
and	O
a	O
boolean	O
indicator	O
,	O
returning	O
T	O
if	O
the	O
hash	B-Algorithm
table	I-Algorithm
contains	O
the	O
key	O
and	O
NIL	O
to	O
signal	O
its	O
absence	O
.	O
</s>
<s>
clrhash	O
completely	O
empties	O
the	O
hash	B-Algorithm
table	I-Algorithm
.	O
</s>
<s>
The	O
dedicated	O
maphash	O
function	O
specializes	O
in	O
iterating	O
hash	B-Algorithm
tables	I-Algorithm
.	O
</s>
<s>
A	O
further	O
option	O
invokes	O
with-hash-table-iterator	O
,	O
an	O
iterator-creating	O
macro	O
,	O
the	O
processing	O
of	O
which	O
is	O
intended	O
to	O
be	O
driven	O
by	O
the	O
caller	O
.	O
</s>
<s>
It	O
is	O
easy	O
to	O
construct	O
composite	O
abstract	O
data	O
types	O
in	O
Lisp	B-Language
,	O
using	O
structures	O
or	O
object-oriented	B-Language
programming	I-Language
features	O
,	O
in	O
conjunction	O
with	O
lists	O
,	O
arrays	O
,	O
and	O
hash	B-Algorithm
tables	I-Algorithm
.	O
</s>
<s>
LPC	B-Application
implements	O
associative	B-Application
arrays	I-Application
as	O
a	O
fundamental	O
type	O
known	O
as	O
either	O
"	O
map	O
"	O
or	O
"	O
mapping	O
"	O
,	O
depending	O
on	O
the	O
driver	O
.	O
</s>
<s>
LPC	B-Application
drivers	O
of	O
the	O
Amylaar	O
family	O
implement	O
multivalued	O
mappings	O
using	O
a	O
secondary	O
,	O
numeric	O
index	O
(	O
other	O
drivers	O
of	O
the	O
MudOS	O
family	O
do	O
not	O
support	O
multivalued	O
mappings	O
.	O
)	O
</s>
<s>
LPC	B-Application
drivers	O
modern	O
enough	O
to	O
support	O
a	O
foreach( )	O
construct	O
use	O
it	O
to	O
iterate	O
through	O
their	O
mapping	O
types	O
.	O
</s>
<s>
In	O
Lua	B-Language
,	O
"	O
table	O
"	O
is	O
a	O
fundamental	O
type	O
that	O
can	O
be	O
used	O
either	O
as	O
an	O
array	O
(	O
numerical	O
index	O
,	O
fast	O
)	O
or	O
as	O
an	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
Lookup	O
is	O
written	O
using	O
either	O
square	O
brackets	O
,	O
which	O
always	O
works	O
,	O
or	O
dot	B-Language
notation	I-Language
,	O
which	O
only	O
works	O
for	O
identifier	O
keys	O
:	O
</s>
<s>
Mathematica	B-Language
and	O
Wolfram	B-Language
Language	I-Language
use	O
the	O
Association	O
expression	O
to	O
represent	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
In	O
MUMPS	B-Language
every	O
array	O
is	O
an	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
Cocoa	B-Operating_System
and	O
GNUstep	B-Application
,	O
written	O
in	O
Objective-C	B-Language
,	O
handle	O
associative	B-Application
arrays	I-Application
using	O
NSMutableDictionary	O
(	O
a	O
mutable	B-Application
version	O
of	O
NSDictionary	O
)	O
class	O
cluster	O
.	O
</s>
<s>
When	O
being	O
inserted	O
to	O
a	O
dictionary	B-Application
,	O
the	O
value	O
object	O
receives	O
a	O
retain	O
message	O
to	O
increase	O
its	O
reference	O
count	O
.	O
</s>
<s>
The	O
value	O
object	O
will	O
receive	O
the	O
release	O
message	O
when	O
it	O
will	O
be	O
deleted	O
from	O
the	O
dictionary	B-Application
(	O
either	O
explicitly	O
or	O
by	O
adding	O
to	O
the	O
dictionary	B-Application
a	O
different	O
object	O
with	O
the	O
same	O
key	O
)	O
.	O
</s>
<s>
In	O
Mac	O
OS	O
X	O
10.5	O
+	O
and	O
iPhone	O
OS	O
,	O
dictionary	B-Application
keys	O
can	O
be	O
enumerated	O
more	O
concisely	O
using	O
the	O
NSFastEnumeration	O
construct	O
:	O
</s>
<s>
What	O
is	O
even	O
more	O
practical	O
,	O
structured	O
data	O
graphs	O
may	O
be	O
easily	O
created	O
using	O
Cocoa	B-Operating_System
,	O
especially	O
NSDictionary	O
(	O
NSMutableDictionary	O
)	O
.	O
</s>
<s>
The	O
OCaml	B-Language
programming	I-Language
language	I-Language
provides	O
three	O
different	O
associative	B-Language
containers	I-Language
.	O
</s>
<s>
The	O
second	O
is	O
a	O
polymorphic	O
hash	B-Algorithm
table	I-Algorithm
:	O
</s>
<s>
The	O
code	O
above	O
uses	O
OCaml	B-Language
's	O
default	O
hash	O
function	O
Hashtbl.hash	O
,	O
which	O
is	O
defined	O
automatically	O
for	O
all	O
types	O
.	O
</s>
<s>
Finally	O
,	O
functional	O
maps	O
(	O
represented	O
as	O
immutable	B-Application
balanced	B-Data_Structure
binary	I-Data_Structure
trees	I-Data_Structure
)	O
:	O
</s>
<s>
By	O
contrast	O
,	O
hash	B-Algorithm
tables	I-Algorithm
provide	O
an	O
imperative	O
interface	O
.	O
</s>
<s>
For	O
many	O
operations	O
,	O
hash	B-Algorithm
tables	I-Algorithm
are	O
significantly	O
faster	O
than	O
lists	O
of	O
pairs	O
and	O
functional	O
maps	O
.	O
</s>
<s>
The	O
OptimJ	B-Application
programming	O
language	O
is	O
an	O
extension	O
of	O
Java	B-Language
5	O
.	O
</s>
<s>
As	O
does	O
Java	B-Language
,	O
Optimj	B-Application
provides	O
maps	O
;	O
but	O
OptimJ	B-Application
also	O
provides	O
true	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
Java	B-Language
arrays	O
are	O
indexed	O
with	O
non-negative	O
integers	O
;	O
associative	B-Application
arrays	I-Application
are	O
indexed	O
with	O
any	O
type	O
of	O
key	O
.	O
</s>
<s>
Of	O
course	O
,	O
it	O
is	O
possible	O
to	O
define	O
multi-dimensional	O
arrays	O
,	O
to	O
mix	O
Java	B-Language
arrays	O
and	O
associative	B-Application
arrays	I-Application
,	O
to	O
mix	O
maps	O
and	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
Perl	O
5	O
has	O
built-in	O
,	O
language-level	O
support	O
for	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
Modern	O
Perl	O
refers	O
to	O
associative	B-Application
arrays	I-Application
as	O
hashes	O
;	O
the	O
term	O
associative	B-Application
array	I-Application
is	O
found	O
in	O
older	O
documentation	O
but	O
is	O
considered	O
somewhat	O
archaic	O
.	O
</s>
<s>
A	O
hash	O
literal	O
is	O
a	O
key-value	O
list	O
,	O
with	O
the	O
preferred	O
form	O
using	O
Perl	O
's	O
=>	O
token	O
,	O
which	O
is	O
semantically	O
mostly	O
identical	O
to	O
the	O
comma	O
and	O
makes	O
the	O
key-value	B-Application
association	I-Application
clearer	O
:	O
</s>
<s>
Perl	B-Application
6	I-Application
,	O
renamed	O
as	O
"	O
Raku	B-Application
"	O
,	O
also	O
has	O
built-in	O
,	O
language-level	O
support	O
for	O
associative	B-Application
arrays	I-Application
,	O
which	O
are	O
referred	O
to	O
as	O
hashes	O
or	O
as	O
objects	O
performing	O
the	O
"	O
associative	O
"	O
role	O
.	O
</s>
<s>
As	O
in	O
Perl	O
5	O
,	O
Perl	B-Application
6	I-Application
default	O
hashes	O
are	O
flat	O
:	O
keys	O
are	O
strings	O
and	O
values	O
are	O
scalars	O
.	O
</s>
<s>
A	O
hash	O
literal	O
is	O
a	O
key-value	O
list	O
,	O
with	O
the	O
preferred	O
form	O
using	O
Perl	O
's	O
=>	O
token	O
,	O
which	O
makes	O
the	O
key-value	B-Application
association	I-Application
clearer	O
:	O
</s>
<s>
Raku	B-Application
does	O
n't	O
have	O
any	O
references	O
.	O
</s>
<s>
PHP	B-Application
's	O
built-in	O
array	O
type	O
is	O
,	O
in	O
reality	O
,	O
an	O
associative	B-Application
array	I-Application
.	O
</s>
<s>
Even	O
when	O
using	O
numerical	O
indexes	O
,	O
PHP	B-Application
internally	O
stores	O
arrays	O
as	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
So	O
,	O
PHP	B-Application
can	O
have	O
non-consecutively	O
numerically-indexed	O
arrays	O
.	O
</s>
<s>
PHP	B-Application
's	O
associative	B-Application
arrays	I-Application
can	O
be	O
used	O
to	O
represent	O
trees	O
,	O
lists	O
,	O
stacks	O
,	O
queues	O
,	O
and	O
other	O
common	O
data	B-General_Concept
structures	I-General_Concept
not	O
built	O
into	O
PHP	B-Application
.	O
</s>
<s>
An	O
associative	B-Application
array	I-Application
can	O
be	O
declared	O
using	O
the	O
following	O
syntax	O
:	O
</s>
<s>
PHP	B-Application
can	O
loop	O
through	O
an	O
associative	B-Application
array	I-Application
as	O
follows	O
:	O
</s>
<s>
PHP	B-Application
has	O
an	O
extensive	O
set	O
of	O
functions	O
to	O
operate	O
on	O
arrays	O
.	O
</s>
<s>
Associative	B-Application
arrays	I-Application
that	O
can	O
use	O
objects	O
as	O
keys	O
,	O
instead	O
of	O
strings	O
and	O
integers	O
,	O
can	O
be	O
implemented	O
with	O
the	O
SplObjectStorage	O
class	O
from	O
the	O
Standard	O
PHP	B-Application
Library	O
(	O
SPL	O
)	O
.	O
</s>
<s>
Pike	O
has	O
built-in	O
support	O
for	O
associative	B-Application
arrays	I-Application
,	O
which	O
are	O
referred	O
to	O
as	O
mappings	O
.	O
</s>
<s>
In	O
PostScript	B-Language
,	O
associative	B-Application
arrays	I-Application
are	O
called	O
dictionaries	B-Application
.	O
</s>
<s>
In	O
Level	O
1	O
PostScript	B-Language
they	O
must	O
be	O
created	O
explicitly	O
,	O
but	O
Level	O
2	O
introduced	O
direct	O
declaration	O
using	O
a	O
double-angled-bracket	O
syntax	O
:	O
</s>
<s>
Dictionaries	B-Application
can	O
be	O
accessed	O
directly	O
,	O
using	O
get	O
,	O
or	O
implicitly	O
,	O
by	O
placing	O
the	O
dictionary	B-Application
on	O
the	O
dictionary	B-Application
stack	O
using	O
begin	O
:	O
</s>
<s>
Dictionary	B-Application
contents	O
can	O
be	O
iterated	O
through	O
using	O
forall	O
,	O
though	O
not	O
in	O
any	O
particular	O
order	O
:	O
</s>
<s>
Dictionaries	B-Application
can	O
be	O
augmented	O
(	O
up	O
to	O
their	O
defined	O
size	O
only	O
in	O
Level	O
1	O
)	O
or	O
altered	O
using	O
put	O
,	O
and	O
entries	O
can	O
be	O
removed	O
using	O
undef	O
:	O
</s>
<s>
Some	O
versions	O
of	O
Prolog	B-Language
include	O
dictionary	B-Application
(	O
"	O
dict	O
"	O
)	O
utilities	O
.	O
</s>
<s>
In	O
Python	B-Language
,	O
associative	B-Application
arrays	I-Application
are	O
called	O
"	O
dictionaries	B-Application
"	O
.	O
</s>
<s>
Dictionary	B-Application
literals	O
are	O
delimited	O
by	O
curly	O
braces	O
:	O
</s>
<s>
Dictionary	B-Application
items	O
can	O
be	O
accessed	O
using	O
the	O
array	O
indexing	O
operator	O
:	O
</s>
<s>
Loop	O
iterating	O
through	O
all	O
the	O
keys	O
of	O
the	O
dictionary	B-Application
:	O
</s>
<s>
Iterating	O
through	O
(	O
key	O
,	O
value	O
)	O
tuples	B-Application
:	O
</s>
<s>
Dictionary	B-Application
keys	O
can	O
be	O
individually	O
deleted	O
using	O
the	O
del	O
statement	O
.	O
</s>
<s>
Python	B-Language
2.7	O
and	O
3.x	O
also	O
support	O
dictionary	B-Application
list	B-Language
comprehension	I-Language
,	O
a	O
compact	O
syntax	O
for	O
generating	O
a	O
dictionary	B-Application
from	O
any	O
iterator	O
:	O
</s>
<s>
Strictly	O
speaking	O
,	O
a	O
dictionary	B-Application
is	O
a	O
super-set	O
of	O
an	O
associative	B-Application
array	I-Application
,	O
since	O
neither	O
the	O
keys	O
or	O
values	O
are	O
limited	O
to	O
a	O
single	O
datatype	O
.	O
</s>
<s>
One	O
could	O
think	O
of	O
a	O
dictionary	B-Application
as	O
an	O
"	O
associative	B-Application
list	I-Application
"	O
using	O
the	O
nomenclature	O
of	O
Python	B-Language
.	O
</s>
<s>
The	O
dictionary	B-Application
keys	O
must	O
be	O
of	O
an	O
immutable	B-Application
data	O
type	O
.	O
</s>
<s>
In	O
Python	B-Language
,	O
strings	O
are	O
immutable	B-Application
due	O
to	O
their	O
method	O
of	O
implementation	O
.	O
</s>
<s>
In	O
Red	B-Language
the	O
built-in	O
map	O
!	O
</s>
<s>
datatype	O
provides	O
an	O
associative	B-Application
array	I-Application
that	O
maps	O
values	O
of	O
word	O
,	O
string	O
,	O
and	O
scalar	O
key	O
types	O
to	O
values	O
of	O
any	O
type	O
.	O
</s>
<s>
A	O
hash	B-Algorithm
table	I-Algorithm
is	O
used	O
internally	O
for	O
lookup	O
.	O
</s>
<s>
In	O
REXX	B-Language
,	O
associative	B-Application
arrays	I-Application
are	O
called	O
"	O
stem	O
variables	O
"	O
or	O
"	O
Compound	O
variables	O
"	O
.	O
</s>
<s>
Stem	O
variables	O
with	O
numeric	O
keys	O
typically	O
start	O
at	O
1	O
and	O
go	B-Application
up	O
from	O
there	O
.	O
</s>
<s>
keys	O
are	O
stored	O
in	O
a	O
separate	O
associative	B-Application
array	I-Application
,	O
with	O
numeric	O
keys	O
.	O
</s>
<s>
In	O
Ruby	B-Language
a	O
hash	B-Algorithm
table	I-Algorithm
is	O
used	O
as	O
follows	O
:	O
</s>
<s>
Ruby	B-Language
supports	O
hash	O
looping	O
and	O
iteration	O
with	O
the	O
following	O
syntax	O
:	O
</s>
<s>
Ruby	B-Language
also	O
supports	O
many	O
other	O
useful	O
operations	O
on	O
hashes	O
,	O
such	O
as	O
merging	O
hashes	O
,	O
selecting	O
or	O
rejecting	O
elements	O
that	O
meet	O
some	O
criteria	O
,	O
inverting	O
(	O
swapping	O
the	O
keys	O
and	O
values	O
)	O
,	O
and	O
flattening	O
a	O
hash	O
into	O
an	O
array	O
.	O
</s>
<s>
The	O
Rust	B-Application
standard	O
library	O
provides	O
a	O
hash	B-Algorithm
map	I-Algorithm
(	O
std::collections::HashMap	O
)	O
and	O
a	O
B-tree	B-Architecture
map	O
(	O
std::collections::BTreeMap	O
)	O
.	O
</s>
<s>
The	O
HashMap	B-Algorithm
requires	O
keys	O
to	O
implement	O
the	O
Eq	O
(	O
equivalence	O
relation	O
)	O
and	O
Hash	O
(	O
hashability	O
)	O
traits	O
and	O
it	O
stores	O
entries	O
in	O
an	O
unspecified	O
order	O
,	O
and	O
the	O
BTreeMap	O
requires	O
the	O
Ord	O
(	O
total	O
order	O
)	O
trait	O
for	O
its	O
keys	O
and	O
it	O
stores	O
entries	O
in	O
an	O
order	O
defined	O
by	O
the	O
key	O
type	O
.	O
</s>
<s>
The	O
default	O
iterators	O
visit	O
all	O
entries	O
as	O
tuples	B-Application
.	O
</s>
<s>
The	O
HashMap	B-Algorithm
iterators	O
visit	O
entries	O
in	O
an	O
unspecified	O
order	O
and	O
the	O
BTreeMap	O
iterator	O
visits	O
entries	O
in	O
the	O
order	O
defined	O
by	O
the	O
key	O
type	O
.	O
</s>
<s>
S-Lang	B-Device
has	O
an	O
associative	B-Application
array	I-Application
type	O
:	O
</s>
<s>
Scala	B-Application
provides	O
an	O
immutable	B-Application
Map	O
class	O
as	O
part	O
of	O
the	O
scala.collection	O
framework	O
:	O
</s>
<s>
Scala	B-Application
's	O
type	O
inference	O
will	O
decide	O
that	O
this	O
is	O
a	O
Map[ String	O
,	O
String ]	O
.	O
</s>
<s>
This	O
returns	O
an	O
Option	O
type	O
,	O
Scala	B-Application
's	O
equivalent	O
of	O
the	O
Maybe	O
monad	O
in	O
Haskell	B-Language
.	O
</s>
<s>
In	O
Smalltalk	B-Application
a	O
Dictionary	B-Application
is	O
used	O
:	O
</s>
<s>
To	O
access	O
an	O
entry	O
the	O
message	O
#at	O
:	O
is	O
sent	O
to	O
the	O
dictionary	B-Application
object	O
:	O
</s>
<s>
SNOBOL	B-Application
is	O
one	O
of	O
the	O
first	O
(	O
if	O
not	O
the	O
first	O
)	O
programming	O
languages	O
to	O
use	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
Associative	B-Application
arrays	I-Application
in	O
SNOBOL	B-Application
are	O
called	O
Tables	O
.	O
</s>
<s>
The	O
SML'97	O
standard	O
of	O
the	O
Standard	B-Language
ML	I-Language
programming	O
language	O
does	O
not	O
provide	O
any	O
associative	B-Language
containers	I-Language
.	O
</s>
<s>
However	O
,	O
various	O
implementations	O
of	O
Standard	B-Language
ML	I-Language
do	O
provide	O
associative	B-Language
containers	I-Language
.	O
</s>
<s>
The	O
library	O
of	O
the	O
popular	O
Standard	B-Application
ML	I-Application
of	I-Application
New	I-Application
Jersey	I-Application
(	O
SML/NJ	B-Application
)	O
implementation	O
provides	O
a	O
signature	O
(	O
somewhat	O
like	O
an	O
"	O
interface	O
"	O
)	O
,	O
ORD_MAP	O
,	O
which	O
defines	O
a	O
common	O
interface	O
for	O
ordered	O
functional	O
(	O
immutable	B-Application
)	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
There	O
are	O
several	O
general	O
functors	O
—	O
BinaryMapFn	O
,	O
ListMapFn	O
,	O
RedBlackMapFn	O
,	O
and	O
SplayMapFn	O
—	O
that	O
allow	O
you	O
to	O
create	O
the	O
corresponding	O
type	O
of	O
ordered	O
map	O
(	O
the	O
types	O
are	O
a	O
self-balancing	B-Data_Structure
binary	I-Data_Structure
search	I-Data_Structure
tree	I-Data_Structure
,	O
sorted	O
association	B-Data_Structure
list	I-Data_Structure
,	O
red	B-Language
–	O
black	O
tree	O
,	O
and	O
splay	B-Data_Structure
tree	I-Data_Structure
,	O
respectively	O
)	O
using	O
a	O
user-provided	O
structure	O
to	O
describe	O
the	O
key	O
type	O
and	O
comparator	O
.	O
</s>
<s>
In	O
addition	O
,	O
there	O
are	O
two	O
pre-defined	O
modules	O
for	O
associative	B-Application
arrays	I-Application
that	O
employ	O
integer	O
keys	O
:	O
IntBinaryMap	O
and	O
IntListMap	O
.	O
</s>
<s>
SML/NJ	B-Application
also	O
provides	O
a	O
polymorphic	O
hash	B-Algorithm
table	I-Algorithm
:	O
</s>
<s>
Monomorphic	O
hash	B-Algorithm
tables	I-Algorithm
are	O
also	O
supported	O
,	O
using	O
the	O
HashTableFn	O
functor	O
.	O
</s>
<s>
Another	O
Standard	B-Language
ML	I-Language
implementation	O
,	O
Moscow	O
ML	O
,	O
also	O
provides	O
some	O
associative	B-Language
containers	I-Language
.	O
</s>
<s>
First	O
,	O
it	O
provides	O
polymorphic	O
hash	B-Algorithm
tables	I-Algorithm
in	O
the	O
Polyhash	O
structure	O
.	O
</s>
<s>
Also	O
,	O
some	O
functional	O
maps	O
from	O
the	O
SML/NJ	B-Application
library	O
above	O
are	O
available	O
as	O
Binarymap	O
,	O
Splaymap	O
,	O
and	O
Intmap	O
structures	O
.	O
</s>
<s>
There	O
are	O
two	O
Tcl	B-Operating_System
facilities	O
that	O
support	O
associative-array	O
semantics	O
.	O
</s>
<s>
A	O
"	O
dict	O
"	O
is	O
a	O
full	O
implementation	O
of	O
associative	B-Application
arrays	I-Application
.	O
</s>
<s>
To	O
retrieve	O
the	O
entire	O
array	O
as	O
a	O
dictionary	B-Application
:	O
</s>
<s>
The	O
result	O
can	O
be	O
(	O
order	O
of	O
keys	O
is	O
unspecified	O
,	O
not	O
because	O
the	O
dictionary	B-Application
is	O
unordered	O
,	O
but	O
because	O
the	O
array	O
is	O
)	O
:	O
</s>
<s>
Visual	B-Language
Basic	I-Language
can	O
use	O
the	O
Dictionary	B-Application
class	O
from	O
the	O
Microsoft	O
Scripting	O
Runtime	O
(	O
which	O
is	O
shipped	O
with	O
Visual	B-Language
Basic	I-Language
6	I-Language
)	O
.	O
</s>
<s>
Visual	B-Language
Basic	I-Language
.NET	I-Language
uses	O
the	O
collection	O
classes	O
provided	O
by	O
the	O
.NET	B-Application
Framework	I-Application
.	O
</s>
<s>
The	O
following	O
code	O
demonstrates	O
the	O
creation	O
and	O
population	O
of	O
a	O
dictionary	B-Application
(	O
see	O
the	O
C#	B-Application
example	O
on	O
this	O
page	O
for	O
additional	O
information	O
)	O
:	O
</s>
<s>
Example	O
demonstrating	O
access	O
(	O
see	O
C#	B-Application
access	O
)	O
:	O
</s>
<s>
Example	O
demonstrating	O
enumeration	O
(	O
see	O
#C	O
#	O
enumeration	O
)	O
:	O
</s>
<s>
Unlike	O
many	O
other	O
command	O
line	O
interpreters	O
,	O
Windows	B-Application
PowerShell	I-Application
has	O
built-in	O
,	O
language-level	O
support	O
for	O
defining	O
associative	B-Application
arrays	I-Application
:	O
</s>
<s>
As	O
in	O
JavaScript	B-Language
,	O
if	O
the	O
property	O
name	O
is	O
a	O
valid	O
identifier	O
,	O
the	O
quotes	O
can	O
be	O
omitted	O
:	O
</s>
<s>
Keys	O
and	O
values	O
can	O
be	O
any	O
.NET	B-Application
object	O
type	O
:	O
</s>
<s>
It	O
is	O
also	O
possible	O
to	O
create	O
an	O
empty	O
associative	B-Application
array	I-Application
and	O
add	O
single	O
entries	O
,	O
or	O
even	O
other	O
associative	B-Application
arrays	I-Application
,	O
to	O
it	O
later	O
on	O
:	O
</s>
<s>
New	O
entries	O
can	O
also	O
be	O
added	O
by	O
using	O
the	O
array	O
index	O
operator	O
,	O
the	O
property	O
operator	O
,	O
or	O
the	O
Add( )	O
method	O
of	O
the	O
underlying	O
.NET	B-Application
object	O
:	O
</s>
<s>
To	O
dereference	O
assigned	O
objects	O
,	O
the	O
array	O
index	O
operator	O
,	O
the	O
property	O
operator	O
,	O
or	O
the	O
parameterized	O
property	O
Item( )	O
of	O
the	O
.NET	B-Application
object	O
can	O
be	O
used	O
:	O
</s>
<s>
You	O
can	O
loop	O
through	O
an	O
associative	B-Application
array	I-Application
as	O
follows	O
:	O
</s>
<s>
An	O
entry	O
can	O
be	O
removed	O
using	O
the	O
Remove( )	O
method	O
of	O
the	O
underlying	O
.NET	B-Application
object	O
:	O
</s>
<s>
Hash	B-Algorithm
tables	I-Algorithm
can	O
be	O
added	O
:	O
</s>
<s>
In	O
JSON	B-General_Concept
,	O
associative	B-Application
arrays	I-Application
are	O
also	O
referred	O
to	O
as	O
objects	O
.	O
</s>
<s>
YAML	B-Protocol
associative	B-Application
arrays	I-Application
are	O
also	O
called	O
map	O
elements	O
or	O
key-value	O
pairs	O
.	O
</s>
<s>
YAML	B-Protocol
places	O
no	O
restrictions	O
on	O
the	O
types	O
of	O
keys	O
;	O
in	O
particular	O
,	O
they	O
are	O
not	O
restricted	O
to	O
being	O
scalar	O
or	O
string	O
values	O
.	O
</s>
