BMapJid is the base class for balanced tree maps which, like bListJid, provide for super-fast incremental deserialization and reserialization. BMapJid has 3 subclasses, IntegerBMapJid, LongBMapJid and StringBMapJid, which support Integer, Long and String keys respectively.
BMapJid<KEY_TYPE, VALUE_TYPE> is a collection of MapEntry objects, where MapEntry holds a key/value pair. BMapJid is effectively a sorted list of MapEntry objects, with fast indexing supporting the same methods as BListJid exception only the iAdd and iAddBytes methods are not supported. But access by key is also supported. These additional methods include
- int size() - Returns the number of entries.
- boolean kMake(KEY_TYPE key) - Returns true if a new entry is created; otherwise false.
- boolean kRemove(KEY_TYPE key) - Returns true if an entry with the given key was previously present.
- MapEntry<KEY_TYPE, VALUE_TYPE> kGetEntry(KEY_TYPE key) - Returns the selected entry, or null.
- VALUE_TYPE kGet(KEY_TYPE key) - Returns the Jid assigned to the key.
- MapEntry<KEY_TYPE, VALUE_TYPE> getCeiling(KEY_TYPE key) - Returns the MapEntry with the smallest key that is greater or equal to the given key, or null. And
- MapEntry<KEY_TYPE, VALUE_TYPE> getHigher(KEY_TYPE key) - Returns the MapEntry with the smallest key that is greater than the given key, or null.
BMapJid objects are created using a registered factory object. As a convenience, JidFactories registers 24 such factory objects, though it is easy enough to define register additional factory objects using the IntegerBMapJidFactory, LongBMapJidFactory and StringBMapJidFactory classes.