V
- public abstract class Init<V> extends Object
Modifier and Type | Field and Description |
---|---|
static Init<AtomicInteger> |
newAtmInt |
static Init<ConcurrentHashMap<Integer,AtomicInteger>> |
newCountMap |
static Init<gnu.trove.list.array.TIntArrayList> |
newIntList |
static Init<LinkedList<Integer>> |
newLkdList |
static Init<gnu.trove.map.hash.TIntIntHashMap> |
newTIntMap |
Constructor and Description |
---|
Init() |
Modifier and Type | Method and Description |
---|---|
static <K,V> V |
fastGet(Map<K,V> map,
K key,
Init<V> initiailzer)
Non thread-safe version of
getOrCreate(ConcurrentMap, Object, Init)
without writing to the map |
static <K,V> V |
getOrCreate(ConcurrentMap<K,V> map,
K key,
Init<V> initiailzer)
Atomic initialization and gets
for concurrent maps.
|
abstract V |
init() |
public static final Init<AtomicInteger> newAtmInt
public static final Init<LinkedList<Integer>> newLkdList
public static final Init<gnu.trove.list.array.TIntArrayList> newIntList
public static final Init<gnu.trove.map.hash.TIntIntHashMap> newTIntMap
public static final Init<ConcurrentHashMap<Integer,AtomicInteger>> newCountMap
public abstract V init()
public static <K,V> V fastGet(Map<K,V> map, K key, Init<V> initiailzer)
getOrCreate(ConcurrentMap, Object, Init)
without writing to the mapmap
- key
- initiailzer
- public static <K,V> V getOrCreate(ConcurrentMap<K,V> map, K key, Init<V> initiailzer)
map
- key
- initiailzer
- Copyright © 2017. All rights reserved.