public final class ImmutableOpenMap<KType,VType>
extends java.lang.Object
implements java.lang.Iterable<com.carrotsearch.hppc.cursors.ObjectObjectCursor<KType,VType>>
Can be constructed using a builder()
, or using builder(ImmutableOpenMap)
(which is an optimized
option to copy over existing content and modify it).
Modifier and Type | Class and Description |
---|---|
static class |
ImmutableOpenMap.Builder<KType,VType> |
Modifier and Type | Method and Description |
---|---|
static <KType,VType> |
builder() |
static <KType,VType> |
builder(ImmutableOpenMap<KType,VType> map) |
static <KType,VType> |
builder(int size) |
boolean |
containsKey(KType key)
Returns
true if this container has an association to a value for
the given key. |
static <KType,VType> |
copyOf(com.carrotsearch.hppc.ObjectObjectMap<KType,VType> map) |
boolean |
equals(java.lang.Object o) |
VType |
get(KType key) |
VType |
getOrDefault(KType key,
VType defaultValue) |
int |
hashCode() |
boolean |
isEmpty() |
java.util.Iterator<com.carrotsearch.hppc.cursors.ObjectObjectCursor<KType,VType>> |
iterator()
Returns a cursor over the entries (key-value pairs) in this map.
|
com.carrotsearch.hppc.ObjectLookupContainer<KType> |
keys()
Returns a specialized view of the keys of this associated container.
|
java.util.Iterator<KType> |
keysIt()
Returns a direct iterator over the keys.
|
static <KType,VType> |
of() |
int |
size() |
java.lang.String |
toString() |
com.carrotsearch.hppc.ObjectContainer<VType> |
values() |
java.util.Iterator<VType> |
valuesIt()
Returns a direct iterator over the keys.
|
public VType get(KType key)
Important note: For primitive type values, the value returned for a non-existing key may not be the default value of the primitive type (it may be any value previously assigned to that slot).
public VType getOrDefault(KType key, VType defaultValue)
public boolean containsKey(KType key)
true
if this container has an association to a value for
the given key.public int size()
public boolean isEmpty()
true
if this hash map contains no assigned keys.public java.util.Iterator<com.carrotsearch.hppc.cursors.ObjectObjectCursor<KType,VType>> iterator()
Iterator.next()
. To read the current key and value use the cursor's
public fields. An example is shown below.
for (IntShortCursor c : intShortMap) { System.out.println("index=" + c.index + " key=" + c.key + " value=" + c.value); }
The index
field inside the cursor gives the internal index inside
the container's implementation. The interpretation of this index depends on
to the container.
public com.carrotsearch.hppc.ObjectLookupContainer<KType> keys()
ObjectLookupContainer
.public java.util.Iterator<KType> keysIt()
public com.carrotsearch.hppc.ObjectContainer<VType> values()
public java.util.Iterator<VType> valuesIt()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public static <KType,VType> ImmutableOpenMap<KType,VType> of()
public static <KType,VType> ImmutableOpenMap<KType,VType> copyOf(com.carrotsearch.hppc.ObjectObjectMap<KType,VType> map)
public static <KType,VType> ImmutableOpenMap.Builder<KType,VType> builder()
public static <KType,VType> ImmutableOpenMap.Builder<KType,VType> builder(int size)
public static <KType,VType> ImmutableOpenMap.Builder<KType,VType> builder(ImmutableOpenMap<KType,VType> map)