public class Collections
extends java.lang.Object
OptionValues.isDeterministicCollectionsEnabled()
is enabled, the methods return collections with predictable iteration order.Modifier and Type | Method and Description |
---|---|
static <T1,T2> void |
addAllToMapSet(java.util.Map<T1,java.util.Set<T2>> map,
T1 key,
java.util.Collection<T2> values)
Adds elements to a map of sets.
|
static <T1,T2> void |
addToMapList(java.util.Map<T1,java.util.List<T2>> map,
T1 key,
T2 value)
Adds an element to a map of lists.
|
static <T1,T2,T3> void |
addToMapMap(java.util.Map<T1,java.util.Map<T2,T3>> map,
T1 key1,
T2 key2,
T3 value)
Adds an element to a map of maps.
|
static <T1,T2,T3> void |
addToMapMapSet(java.util.Map<T1,java.util.Map<T2,java.util.Set<T3>>> map,
T1 key1,
T2 key2,
T3 value)
Adds an element to a map of maps of sets.
|
static <T1,T2> void |
addToMapSet(java.util.Map<T1,java.util.Set<T2>> map,
T1 key,
T2 value)
Adds an element to a map of sets.
|
static <K,V> java.lang.String |
diff(java.util.Map<K,V> m1,
java.util.Map<K,V> m2)
Returns a string description of the differences between the two maps.
|
static <C,T> java.util.Collection<T> |
map(java.util.Collection<C> ts,
java.util.function.Function<C,T> f)
Applies f to each element in the collection, producing a new collection.
|
static <T> java.util.List<T> |
newList()
Constructs a new empty list.
|
static <T> java.util.List<T> |
newList(java.util.Collection<T> s)
Constructs a new list from the given collection.
|
static <T1,T2> java.util.Map<T1,T2> |
newMap()
Constructs a new empty map.
|
static <T1,T2> java.util.Map<T1,T2> |
newMap(java.util.Map<T1,T2> m)
Constructs a new map as a copy of the given map.
|
static <T1,T2,T3> java.util.Map<T1,java.util.Map<T2,java.util.Set<T3>>> |
newMapMapSet(java.util.Map<T1,java.util.Map<T2,java.util.Set<T3>>> m)
Constructs a new map as a copy of the given map (with copies of its values which are map sets)
|
static <T1,T2> java.util.Map<T1,java.util.Set<T2>> |
newMapSet(java.util.Map<T1,java.util.Set<T2>> m)
Constructs a new map as a copy of the given map (with copies of its values which are sets)
|
static <T> java.util.Set<T> |
newSet()
Constructs a new empty set.
|
static <T> java.util.Set<T> |
newSet(java.util.Collection<T> s)
Constructs a new set from the given collection.
|
static <T> java.util.Set<T> |
singleton(T t)
Constructs a new mutable singleton set containing the given element.
|
static <T> java.util.List<T> |
singletonList(T t)
Constructs a new mutable singleton list containing the given element.
|
static <K extends java.lang.Comparable<K>,V> |
sortedEntries(java.util.Map<K,V> m)
Returns an ordered set of map entries, sorted by the natural order of the entry keys.
|
static <K,V> java.util.TreeSet<java.util.Map.Entry<K,V>> |
sortedEntries(java.util.Map<K,V> m,
java.util.Comparator<K> c)
Returns an ordered set of map entries, sorted using the given comparator.
|
public static <T1,T2> void addAllToMapSet(java.util.Map<T1,java.util.Set<T2>> map, T1 key, java.util.Collection<T2> values)
public static <T1,T2> void addToMapList(java.util.Map<T1,java.util.List<T2>> map, T1 key, T2 value)
public static <T1,T2,T3> void addToMapMap(java.util.Map<T1,java.util.Map<T2,T3>> map, T1 key1, T2 key2, T3 value)
public static <T1,T2,T3> void addToMapMapSet(java.util.Map<T1,java.util.Map<T2,java.util.Set<T3>>> map, T1 key1, T2 key2, T3 value)
public static <T1,T2> void addToMapSet(java.util.Map<T1,java.util.Set<T2>> map, T1 key, T2 value)
public static <K,V> java.lang.String diff(java.util.Map<K,V> m1, java.util.Map<K,V> m2)
public static <C,T> java.util.Collection<T> map(java.util.Collection<C> ts, java.util.function.Function<C,T> f)
public static <T> java.util.List<T> newList()
public static <T> java.util.List<T> newList(java.util.Collection<T> s)
public static <T1,T2> java.util.Map<T1,T2> newMap()
public static <T1,T2> java.util.Map<T1,T2> newMap(java.util.Map<T1,T2> m)
public static <T1,T2,T3> java.util.Map<T1,java.util.Map<T2,java.util.Set<T3>>> newMapMapSet(java.util.Map<T1,java.util.Map<T2,java.util.Set<T3>>> m)
public static <T1,T2> java.util.Map<T1,java.util.Set<T2>> newMapSet(java.util.Map<T1,java.util.Set<T2>> m)
public static <T> java.util.Set<T> newSet()
public static <T> java.util.Set<T> newSet(java.util.Collection<T> s)
public static <T> java.util.Set<T> singleton(T t)
newSet()
), unlike java.util.Collections.singleton.public static <T> java.util.List<T> singletonList(T t)
newList()
), unlike java.util.Collections.singletonList.public static <K extends java.lang.Comparable<K>,V> java.util.TreeSet<java.util.Map.Entry<K,V>> sortedEntries(java.util.Map<K,V> m)
public static <K,V> java.util.TreeSet<java.util.Map.Entry<K,V>> sortedEntries(java.util.Map<K,V> m, java.util.Comparator<K> c)
Copyright © 2009-2019 Aarhus University