public abstract class LazyMap<K,V> extends Object
Constructor and Description |
---|
LazyMap() |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the map.
|
static <K,V extends Comparable<V>> |
convertToMultiMapSorted(LazyMap<K,HashSet<V>> lazyMap)
Convert a lazy MultiSet into a lazy MultiMap.
|
void |
generateAllValues(Collection<K> keys)
Ensure that all keys in the provided collection have been initialized or generated.
|
protected V |
generateValue(K key)
Override this to generate a single value each time get() is called.
|
V |
get(K key)
Get the requested key.
|
void |
initialize()
Override this to initialize the entire map the first time get() is called.
|
static <K,V,T> LazyMap<V,HashSet<K>> |
invertMultiSet(LazyMap<K,HashSet<V>> lazyMap)
Invert the map to find the preimage of each unique value.
|
static <K,V,T> LazyMap<V,HashSet<K>> |
invertMultiSet(LazyMap<K,HashSet<V>> lazyMap,
LazyMap<K,T> templateLazyMap)
For all keys in templateLazyMap, generate the value for each key, then invert the map to find the preimage of
each unique value.
|
Set<K> |
keySet()
Returns all keys in the map that have been initialized so far.
|
String |
toString() |
Collection<V> |
values()
Returns all values in the map that have been initialized so far.
|
protected V generateValue(K key)
public void initialize()
public void clear()
public void generateAllValues(Collection<K> keys)
public V get(K key)
public Collection<V> values()
public Set<K> keySet()
public static <K,V,T> LazyMap<V,HashSet<K>> invertMultiSet(LazyMap<K,HashSet<V>> lazyMap, LazyMap<K,T> templateLazyMap)
public static <K,V,T> LazyMap<V,HashSet<K>> invertMultiSet(LazyMap<K,HashSet<V>> lazyMap)
public static <K,V extends Comparable<V>> LazyMap<K,ArrayList<V>> convertToMultiMapSorted(LazyMap<K,HashSet<V>> lazyMap)
Copyright © 2016. All rights reserved.