Class LazyHashMap<K,V>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<K,V>
-
- org.apache.felix.bundlerepository.impl.LazyHashMap<K,V>
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.Map<K,V>
public class LazyHashMap<K,V> extends java.util.HashMap<K,V> implements java.util.Map<K,V>
A map that can delay the computation of certain values up until the moment that they are actually needed. Useful for expensive to compute values such as the SHA-256. This map does not supportnull
values.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LazyHashMap.LazyValue<K,V>
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<K,java.util.concurrent.Callable<V>>
lazyValuesMap
-
Constructor Summary
Constructors Constructor Description LazyHashMap(java.util.Collection<LazyHashMap.LazyValue<K,V>> lazyValues)
This map behaves like a normal HashMap, expect for the entries passed in as lazy values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description V
get(java.lang.Object key)
V
put(K key, V value)
-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, getOrDefault, isEmpty, keySet, merge, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Constructor Detail
-
LazyHashMap
public LazyHashMap(java.util.Collection<LazyHashMap.LazyValue<K,V>> lazyValues)
This map behaves like a normal HashMap, expect for the entries passed in as lazy values. A lazy value is a Callable object associated with a key. When the key is looked up and it's one of the lazy values, the value will be computed at that point and stored in the map. If the value is looked up again, it will be served from the map as usual.- Parameters:
lazyValues
-
-
-