Map with Array of Keys

loop.collection.MapWithArrayOfKeys


Class of objects that store in a single table a mapping of non-integer key values to arbitrary values and a sequence of all the key values currently mapped. The array of keys is stored just like the sequence stored by UnorderedArray instances. This class is useful for storing a map of non-integer values and an array of its keys in a single table.

Each non-integer key indexes its mapped value. Integer keys are used to store mapped keys as an array.

Behavior

Methods

add(key, value)
Adds the mapping of value key to value to the map.
value(key [, value])
If value is provided then the mapped value for key key is replaced by value value. Otherwise, the value mapped by key key is returned.
valueat(index [, value])
If value is provided then the mapped value for the key stored at position index is replaced by value value. Otherwise, the value mapped by key stored at position index is returned.
remove(key)
Removes the mapping of key from the map and the array.
removeat(index)
Removes the mapping of key stored at position index from the map and the array.

Remarks

Copyright (C) 2004-2008 Tecgraf, PUC-RioThis project is currently being maintained by Tecgraf at PUC-Rio.