Package org.basex.util.hash
Class IntObjMap<E>
java.lang.Object
org.basex.util.hash.ASet
org.basex.util.hash.IntSet
org.basex.util.hash.IntObjMap<E>
- Type Parameters:
E- generic value type
This is an efficient and memory-saving hash map for storing primitive integers
and objects. It extends the
IntSet class.- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Resets the data structure.computeIfAbsent(int key, Supplier<? extends E> func) Returns the value for the specified key.get(int key) Returns the value for the specified key.Indexes the specified key and stores the associated value.protected voidrehash(int newSize) Rehashes all entries.toString()values()Returns a value iterator.
-
Constructor Details
-
IntObjMap
public IntObjMap()Default constructor.
-
-
Method Details
-
put
Indexes the specified key and stores the associated value. If the key already exists, the value is updated.- Parameters:
key- keyvalue- value- Returns:
- old 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 the key was not found
-
values
Returns a value iterator.- Returns:
- iterator
-
rehash
protected void rehash(int newSize) Description copied from class:ASetRehashes all entries. -
clear
public void clear()Description copied from class:ASetResets the data structure. -
toString
-