|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.stanford.nlp.util.Maps
public class Maps
Utilities for Maps, including inverting, composing, and support for list/set values.
Constructor Summary | |
---|---|
Maps()
|
Method Summary | ||
---|---|---|
static
|
compose(Map<X,Y> map1,
Map<Y,Z> map2)
Compose two maps map1:x->y and map2:y->z to get a map x->z |
|
static
|
invert(Map<X,Y> map)
Inverts a map x->y to a map y->x assuming unique preimages. |
|
static
|
invertSet(Map<X,Y> map)
Inverts a map x->y to a map y->pow(x) not assuming unique preimages. |
|
static void |
main(String[] args)
|
|
static
|
putIntoValueArrayList(Map<K,List<V>> map,
K key,
V value)
Adds the value to the ArrayList given by map.get(key), creating a new ArrayList if needed. |
|
static
|
putIntoValueCollection(Map<K,C> map,
K key,
V value,
CollectionFactory<V> cf)
Adds the value to the collection given by map.get(key). |
|
static
|
putIntoValueHashSet(Map<K,Set<V>> map,
K key,
V value)
Adds the value to the HashSet given by map.get(key), creating a new HashMap if needed. |
|
static
|
sortedEntries(Collection<Map.Entry<K,V>> entries)
Sorts a list of entries. |
|
static
|
sortedEntries(Map<K,V> map)
Returns a List of entries in the map, sorted by key. |
|
static
|
toStringSorted(Map<K,V> map)
Stringifies a Map in a stable fashion. |
|
static
|
toStringSorted(Map<K,V> map,
StringBuilder builder)
Stringifies a Map in a stable fashion. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Maps()
Method Detail |
---|
public static <K,V> void putIntoValueHashSet(Map<K,Set<V>> map, K key, V value)
public static <K,V> void putIntoValueArrayList(Map<K,List<V>> map, K key, V value)
public static <K,V,C extends Collection<V>> void putIntoValueCollection(Map<K,C> map, K key, V value, CollectionFactory<V> cf)
public static <X,Y,Z> Map<X,Z> compose(Map<X,Y> map1, Map<Y,Z> map2)
public static <X,Y> Map<Y,X> invert(Map<X,Y> map)
public static <X,Y> Map<Y,Set<X>> invertSet(Map<X,Y> map)
public static <K extends Comparable<? super K>,V> List<Map.Entry<K,V>> sortedEntries(Collection<Map.Entry<K,V>> entries)
public static <K extends Comparable<? super K>,V> List<Map.Entry<K,V>> sortedEntries(Map<K,V> map)
public static <K extends Comparable<K>,V> void toStringSorted(Map<K,V> map, StringBuilder builder)
public static <K extends Comparable<K>,V> String toStringSorted(Map<K,V> map)
public static void main(String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |