A Dictionary is an associative collection mapping keys to values. Two keys match if they are equal. (i.e. == returns true.)
The contents of a Dictionary are unordered. You must not depend on the order of items in a Dictionary. You must only rely on equality for the keys (e.g. symbols are ok, strings not). For identity matching see: IdentityDictionary.
Creates a Dictionary with an initial capacity for n key value mappings.
Creates a new Dictionary from another collection.
any Object that responds to keysValuesDo (usually a List or an Array).
A new Dictionary can also be created from an array of Associations:
Add anAssociation to the Dictionary. If the key value pair already exists in the Dictionary, the key's value will be replaced.
Associate two objects and add them to the Dictionary.
key to associate with object. This can be any objects, but is often a Symbol.
Remove the key and the value associated with it from the Dictionary.
Add all items of each argument to the dictionary.
any Object that responds to keysValuesDo (usually a Dictionary).
Add all items to the dictionary, using them as key and value pairwise.
Access the value associated with the key.
Access the value associated with the key. If the key does not exist, return the result of
Return a Set of all keys.
Return a List of all values.
Return an Array of all values for the given keys.
Return an Array with all keys and values pairwise.
Note that, unlike -asPairs, getPairs will return nil with an empty Dictionary.
Access the Association that has the given key.
Try to find a given value and return its key.
The dictionary's keys are used as conditions against which the arbitrary item is matched. See: matchItem
Most methods for iteration work analogously to Dictionary's superclasses, see e.g. Collection.
Iterate over the associations, and evaluate the function for each, passing key and value as argument.
Iterate over the associations, and evaluate the function for each, passing key and value as argument. Replace the value with the return value from the function (similar to -collect, but modifies the dictionary in place).
Iterate over the associations, and evaluate the function for each, passing key as argument.
Iterate over the associations, and evaluate the function for each.
Iterate over the associations, and evaluate the function for each, passing key and value as argument. Identical to -keysValuesDo
Return a new dictionary with all the values as keys and vice versa.
Return an array of keys which corresponds to the order of the values of the dictionary.
Return the set of all subsets: here an array of all sub-dictionaries.
Combine two dictionaries into a new one by applying a function to each value. If fill is true (default: true), values missing from one of them are kept as they are.
Blend two dictionaries into a new one by interpolating each value. If fill is true (default: true), values missing from one of them are kept as they are.
the blend ratio as a Float between 0.0 and 1.0.
a dictionary of Specs that are applied to each before blending.
Return the values in a sorted array of key value pairs.
If no arguments are passed, return itself. This is part of the Key Value Pairs interface.
This argument is not used, but exists to make the method compatible with Collection: -asDict.
A dictionary class to convert to, if given (conversion is done via
Return the values in an array of alternating key value pairs, like
[\freq, 1848, \amp, 0.2]. This is part of the Key Value Pairs interface.
The class of the collection to be returned. By default this is an Array.
Note that, unlike -getPairs, asPairs will return an empty Array with an empty Dictionary.
The inval, usually in an event stream. See also Event.
If the event is not nil, yields a copy, adding all the elements of the receiver event (this leaves the receiver unchanged). If it is nil, return the receiver.
If a key "embedInStream" is given, use this function instead. The behaviour of the event can be configured easily this way.
The arguments event (the receiver) and inevent (the inevent) are passed to the function.
NOTE: In infinite patterns, you must call yield or embedInStream in the function, otherwise it will loop forever.
A generator for dictionaries:
Often, the subclass Event is used as an IdentityDictionary, because there is a syntactical shortcut:
Event, Environment and IdentityDictionary differ mainly insofar from Dictionary as the keys are taken to be identical (===) objects (see IdentityDictionary), instead of equal (==) objects. By consequence, the subclasses are also faster for indexing. Apart from this, the subclasses add specific functionality only. Because of its very common usage, the examples often use the shortcut for the subclass Event.