Definition §
- Also known as associative arrays, dictionaries store items in <key, value> pairs
- The <key> is used to access the <value>
- Generally, dictionaries are considered to be dynamic, i.e. they can grow/shrink
Signature §
name Dictionary;
import key, value, integer, boolean;
ops:
newDict : → dictionary;
insert : dictionary × key × value → dictionary;
inDict : dictionary × key → boolean;
remove : dictionary × key → dictionary;
lookup : dictionary × key → value;
update : dictionary × key × value → dictionary;
length : dictionary → integer;