Package one.microstream.collections
Class HashMapIdObject<E>
- java.lang.Object
-
- one.microstream.collections.HashMapIdObject<E>
-
- All Implemented Interfaces:
OptimizableCollection
,Sized
,Composition
public final class HashMapIdObject<E> extends Object implements Sized, OptimizableCollection, Composition
Primitive (read: fast) synchronized pseudo map implementation that maps long id values to weakly referenced objects.
-
-
Constructor Summary
Constructors Constructor Description HashMapIdObject()
-
Method Summary
Modifier and Type Method Description boolean
add(long id, E object)
void
clear()
E
get(long id)
XList<Long>
getIds()
XList<E>
getObjects()
boolean
isEmpty()
int
iterate(Consumer<? super KeyValue<Long,E>> procedure)
int
iterateIds(_longProcedure procedure)
int
iterateKeys(Consumer<? super Long> procedure)
int
iterateValues(Consumer<? super E> procedure)
static <T> HashMapIdObject<T>
New()
static <T> HashMapIdObject<T>
New(int initialSlotLength)
long
optimize()
Optimizes the internal storage and returns the remaining amount of entries.boolean
put(long id, E object)
E
putGet(long id, E object)
long
size()
String
toString()
-
-
-
Method Detail
-
New
public static final <T> HashMapIdObject<T> New()
-
New
public static final <T> HashMapIdObject<T> New(int initialSlotLength)
-
add
public final boolean add(long id, E object)
-
put
public final boolean put(long id, E object)
-
get
public final E get(long id)
-
optimize
public final long optimize()
Optimizes the internal storage and returns the remaining amount of entries.- Specified by:
optimize
in interfaceOptimizableCollection
- Returns:
- the amount of entries after the optimization is been completed.
-
iterateIds
public final int iterateIds(_longProcedure procedure)
-
clear
public final void clear()
-
-