Package org.basex.util.hash
Class TokenObjMap<E>
java.lang.Object
org.basex.util.hash.ASet
org.basex.util.hash.TokenSet
org.basex.util.hash.TokenObjMap<E>
- Type Parameters:
E- generic value type
- All Implemented Interfaces:
Iterable<byte[]>
This is an efficient and memory-saving hash map for storing tokens and objects.
hash set.- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Resets the data structure.computeIfAbsent(byte[] key, Supplier<? extends E> func) Returns the value for the specified key.get(byte[] key) Returns the value for the specified key.voidIndexes the specified key and value.protected voidrehash(int newSize) Rehashes all entries.intremove(byte[] key) Removes the entry with the specified key.toString()values()Returns a value iterator.Methods inherited from class org.basex.util.hash.TokenSet
add, add, contains, hash, id, iterator, key, put, read, writeMethods inherited from class org.basex.util.hash.ASet
capacity, checkSize, isEmpty, size, toString, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
TokenObjMap
public TokenObjMap()Default constructor.
-
-
Method Details
-
put
Indexes the specified key and value. If the key exists, the value is updated.- Parameters:
key- keyval- value
-
computeIfAbsent
Returns the value for the specified key. Creates a new value if none exists.- Parameters:
key- keyfunc- function that create a new value- Returns:
- value
-
get
Returns the value for the specified key.- Parameters:
key- key to be looked up- Returns:
- value, or
nullif nothing was found
-
values
Returns a value iterator.- Returns:
- iterator
-
remove
public int remove(byte[] key) Description copied from class:TokenSetRemoves the entry with the specified key. The deletion of keys will lead to empty entries. IfASet.sizeis called after deletions, the original number of entries will be returned. -
clear
public void clear()Description copied from class:ASetResets the data structure. -
rehash
protected void rehash(int newSize) Description copied from class:ASetRehashes all entries. -
toString
-