K - The key type.V - The value type.public class IdMap<K,V> extends ConcurrentHashMap<K,V>
Useful for creating in-memory 'databases' of POJOs.
ConcurrentHashMap.KeySetView<K,V>AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Method and Description |
|---|---|
static <K,T> IdMap<K,T> |
create(Class<T> c,
IdGenerator<K> idGen)
Creates a new map.
|
static <T> IdMap<Integer,T> |
createIntMap(Class<T> c)
Creates a new ID map with integer keys with generator initialized to
|
static <T> IdMap<Integer,T> |
createIntMap(Class<T> c,
int initValue)
Creates a new ID map with integer keys with generator initialized to the specified value.
|
static <T> IdMap<Long,T> |
createLongMap(Class<T> c)
Creates a new ID map with long keys with generator initialized to
|
static <T> IdMap<Long,T> |
createLongMap(Class<T> c,
long initValue)
Creates a new ID map with long keys with generator initialized to the specified value.
|
void |
lbId(K k)
Sets a lower bound on the specified ID.
|
K |
nextId()
Returns the next available ID.
|
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, valuesclonepublic static <T> IdMap<Integer,T> createIntMap(Class<T> c)
c - The value type.public static <T> IdMap<Integer,T> createIntMap(Class<T> c, int initValue)
c - The value type.initValue - The initial value of the generator.public static <T> IdMap<Long,T> createLongMap(Class<T> c)
c - The value type.public static <T> IdMap<Long,T> createLongMap(Class<T> c, long initValue)
c - The value type.initValue - The initial value of the generator.public static <K,T> IdMap<K,T> create(Class<T> c, IdGenerator<K> idGen)
c - The value type.idGen - An ID generator.Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.