# Dictionary

Dictionary inherits from KeyedCollection and defines the instance variable tally. It has a subclass: IdentityDictionary.

Dictionaries map arbitrary keys onto arbitrary values. Dictionary uses equality (=) and hashing (hash) to arrange keys.

## Methods defined in Dictionary:

### Methods for accessing:

- at: key
- at: key ifAbsent: block
- at: key put: value
- capacity
- size
- species

### Methods for adding/removing:

- removeKey: key
- removeKey: key ifAbsent: exceptionBlock

### Methods for copying:

- expand
- expandBy: amount

### Methods for enumerating:

- do: block
- keysAndValuesDo: block
- valuesDo: block

### Methods for initialization:

- initialize

### Methods for predicates:

- includesKey: key

### Methods for printing:

- printOn: stream

### Methods for private:

- findKeyOrNil: key
- fixupAt: index
  Copy-up objects which hashed to the given slot, now that the slot is empty.

### Methods for utility:

- rehash
  Be sure to send this if a key changes its hash value.

Pocket Smalltalk Documentation