Agrona offers a number of efficient zero and/or minimal allocation collection objects for java primitives that avoid boxing. They typically out perform their JDK counterparts.
Agrona HashMaps will normally misbehave when viewed through Java IDE debuggers. To prevent this, set the
shouldAvoidAllocation constructor argument to false. This prevents agrona from caching iterators and map entries and results in increased garbage.
|Int2IntHashMap||Primitive int to int HashMap|
|Int2NullableObjectHashMap||Primitive int to a nullable object HashMap. If null, |
|Int2ObjectHashMap||Primitive int to object HashMap.|
|Long2LongHashMap||Primitive long to long HashMap|
|Long2NullableObjectHashMap||Primitive long to a nullable object HashMap. If null, |
|Long2ObjectHashMap||Primitive long to object HashMap.|
|Object2IntHashMap||Object to primitive int HashMap|
|Object2NullableObjectHashMap||Object to a nullable object HashMap|
|Object2ObjectHashMap||Object to object HashMap.|
With all Agrona HashMap objects, make certain that the
hashCode() implementation is implemented as required. If you have an Aeron Cluster, use the Agrona HashMaps and don't have a deterministic
hashCode() operation, then the cluster nodes may diverge. In addition to this, performance can be severely impacted if there are a high number of collisions in the hashCodes of objects being stored.
|Int2ObjectCache||Cache with primitive int lookup to an object. Tuned for very small data structures stored within CPU cache lines. Typical sizes are 2 to 16 entries. Underlying storage is an array.|
|IntLruCache||Fixed size cache which evicts the least used entry when running out of space.|
|IntHashSet||HashSet for primitive integers. Once expanded, operations are allocation free.|
|ObjectHashSet||HashSet for objects. Once expanded, operations are allocation free.|
|IntArrayList||An array list to hold primitive integers without boxing|
|IntArrayQueue||An array queue to hold primitive integers without boxing|
|BiInt2ObjectMap||A map that takes in a two part integer key and associates it with an object|