public abstract class Collections extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Collections.LiteralList<A>
Very similar to
java.util.Arrays.asList() , but truely immutable. |
static interface |
Collections.LiteralMap<A,B> |
static interface |
Collections.LiteralSet<A> |
Modifier and Type | Method and Description |
---|---|
static <A,B> Map<A,B> |
asGraph(Function<? super A,? extends B> fun,
Set<? extends A> things) |
static <A,B> Collection<B> |
asMap(Function<? super A,? extends B> fun,
Collection<? extends A> things) |
static <A,B,C extends B> |
castValues(Class<? extends C> cls,
Map<A,C> things) |
static <A> Collection<A> |
concat(Collection<? extends A> some,
Collection<? extends A> other) |
static <A,B> Map<B,A> |
converse(Map<A,B> map) |
static <A,B> boolean |
doFilterKey(Predicate<? super A> p,
Map<A,B> m) |
static <A,B> boolean |
doFilterValue(Predicate<? super B> p,
Map<A,B> m) |
static <A> Set<A> |
elements(Collection<? extends A> things) |
static <A> SortedSet<A> |
elements(Collection<? extends A> things,
Comparator<? super A> comparator) |
static <A,B> SortedMap<A,B> |
emptySortedMap() |
static <A> SortedSet<A> |
emptySortedSet() |
static <K,V> Map.Entry<K,V> |
entry(K key,
V value) |
static <A> Collection<A> |
flatten(Collection<? extends Collection<A>> colls) |
static <A,B> B |
fold(GenMonoid<? super A,B> mon,
Collection<? extends A> things) |
static <A,B> B |
fold(GenSemigroup<? super A,B> grp,
Collection<? extends A> things) |
static <A,B> Function<Map.Entry<? extends A,? extends B>,A> |
getKey() |
static <A,B> Function<Map.Entry<? extends A,? extends B>,B> |
getValue() |
static <A> Set<A> |
intersection(Collection<? extends A> some,
Collection<? extends A> other) |
static <T> BiFunction<Set<T>,Set<T>,Set<T>> |
intersectionF() |
static <A> Collections.LiteralList<A> |
literalList()
Very similar to
java.util.Arrays.asList() , but truely immutable. |
static <A> Collections.LiteralList<A> |
literalList(A value)
Very similar to
java.util.Arrays.asList() , but truely immutable. |
static <A> Collections.LiteralList<A> |
literalList(A value1,
A value2)
Very similar to
java.util.Arrays.asList() , but truely immutable. |
static <A> Collections.LiteralList<A> |
literalList(A value1,
A value2,
A value3)
Very similar to
java.util.Arrays.asList() , but truely immutable. |
static <A> Collections.LiteralList<A> |
literalList(A value1,
A value2,
A value3,
A value4)
Very similar to
java.util.Arrays.asList() , but truely immutable. |
static <A,B> Collections.LiteralMap<A,B> |
literalMap() |
static <A,B> Collections.LiteralMap<A,B> |
literalMap(A key,
B value) |
static <A,B> Collections.LiteralMap<A,B> |
literalMap(A key1,
B value1,
A key2,
B value2) |
static <A,B> Collections.LiteralMap<A,B> |
literalMap(A key1,
B value1,
A key2,
B value2,
A key3,
B value3) |
static <A,B> Collections.LiteralMap<A,B> |
literalMap(A key1,
B value1,
A key2,
B value2,
A key3,
B value3,
A key4,
B value4) |
static <A> Collections.LiteralSet<A> |
literalSet() |
static <A> Collections.LiteralSet<A> |
literalSet(A value) |
static <A> Collections.LiteralSet<A> |
literalSet(A value1,
A value2) |
static <A> Collections.LiteralSet<A> |
literalSet(A value1,
A value2,
A value3) |
static <A> Collections.LiteralSet<A> |
literalSet(A value1,
A value2,
A value3,
A value4) |
static <A,B> Collection<B> |
map(Function<? super A,? extends B> fun,
Collection<? extends A> things)
Deprecated.
|
static <A,B,C> Map.Entry<A,C> |
map(Function<? super B,? extends C> fun,
Map.Entry<A,B> e) |
static <A,B,C> Map<A,C> |
map(Function<? super B,? extends C> fun,
Map<A,B> things) |
static <A,B,C> Function<Map.Entry<A,B>,Map.Entry<A,C>> |
mapEntry(Function<? super B,? extends C> fun) |
static <A,B,C> Function<Map.Entry<A,B>,Map.Entry<A,C>> |
mapEntryWithKey(Function<? super Map.Entry<A,B>,? extends C> fun) |
static <A,B,C> Map<A,C> |
mapWithKey(BiFunction<? super A,? super B,? extends C> fun,
Map<A,B> things) |
static <A,B,C> Map<A,C> |
mapWithKey(Function<? super Map.Entry<A,B>,? extends C> fun,
Map<A,B> things) |
static <T> T |
one(Collection<T> set)
Deprecated.
use
the(java.util.Collection<T>) instead. |
static <T> BiFunction<T,T,T> |
otherwise() |
static <A> Set<A> |
setminus(Collection<? extends A> some,
Collection<? extends A> other) |
static <A extends Comparable<? super A>,B> |
singletonSortedMap(A key,
B value) |
static <A,B> SortedMap<A,B> |
singletonSortedMap(Comparator<? super A> comparator,
A key,
B value) |
static <A extends Comparable<? super A>> |
singletonSortedSet(A elem) |
static <A> SortedSet<A> |
singletonSortedSet(Comparator<? super A> comparator,
A elem) |
static <T> T |
some(Collection<T> set) |
static <T> T |
the(Collection<T> set) |
static <A> Collection<A> |
toFilter(Predicate<? super A> pred,
Collection<? extends A> things) |
static <A> List<A> |
toFilter(Predicate<? super A> pred,
List<A> things) |
static <A> Set<A> |
toFilter(Predicate<? super A> pred,
Set<? extends A> things) |
static <A> SortedSet<A> |
toFilter(Predicate<? super A> pred,
SortedSet<A> things) |
static <A,B> Map<A,B> |
toGraph(Function<? super A,? extends B> fun,
Set<? extends A> dom) |
static <A,B> Collection<B> |
toMap(Function<? super A,? extends B> fun,
Collection<? extends A> things) |
static <A,B> Set<B> |
toMap(Function<? super A,? extends B> fun,
Set<? extends A> things) |
static <A,B> SortedSet<B> |
toMap(Function<? super A,? extends B> fun,
SortedSet<A> things,
Comparator<? super B> comparator) |
static <A,B,C> Map<B,C> |
toSpan(Function<? super A,? extends B> left,
Function<? super A,? extends C> right,
Collection<? extends A> gen) |
static <A> Set<A> |
union(Collection<? extends A> some,
Collection<? extends A> other) |
static <T> BiFunction<Set<T>,Set<T>,Set<T>> |
unionF() |
static <K,V> Map.Entry<K,V> |
unmodifiableEntry(Map.Entry<? extends K,? extends V> entry) |
static <A,B,C> Map<A,C> |
zip(GenMonoid<B,C> mon,
Map<A,B> m,
Map<A,B> n) |
public static <A> Collection<A> toFilter(Predicate<? super A> pred, Collection<? extends A> things)
@Deprecated public static <T> T one(Collection<T> set)
the(java.util.Collection<T>)
instead.public static <T> T the(Collection<T> set)
public static <T> T some(Collection<T> set)
@Deprecated public static <A,B> Collection<B> map(Function<? super A,? extends B> fun, Collection<? extends A> things)
instead
or toMap(java.util.function.Function<? super A, ? extends B>, java.util.Collection<? extends A>)
instead.public static <A,B> Collection<B> asMap(Function<? super A,? extends B> fun, Collection<? extends A> things)
public static <A,B> Collection<B> toMap(Function<? super A,? extends B> fun, Collection<? extends A> things)
public static <A,B> Set<B> toMap(Function<? super A,? extends B> fun, Set<? extends A> things)
public static <A,B> SortedSet<B> toMap(Function<? super A,? extends B> fun, SortedSet<A> things, Comparator<? super B> comparator)
public static <A> Collections.LiteralSet<A> literalSet()
public static <A> Collections.LiteralSet<A> literalSet(A value)
public static <A> Collections.LiteralSet<A> literalSet(A value1, A value2)
public static <A> Collections.LiteralSet<A> literalSet(A value1, A value2, A value3)
public static <A> Collections.LiteralSet<A> literalSet(A value1, A value2, A value3, A value4)
public static <A> Collections.LiteralList<A> literalList()
java.util.Arrays.asList()
, but truely immutable.public static <A> Collections.LiteralList<A> literalList(A value)
java.util.Arrays.asList()
, but truely immutable.public static <A> Collections.LiteralList<A> literalList(A value1, A value2)
java.util.Arrays.asList()
, but truely immutable.public static <A> Collections.LiteralList<A> literalList(A value1, A value2, A value3)
java.util.Arrays.asList()
, but truely immutable.public static <A> Collections.LiteralList<A> literalList(A value1, A value2, A value3, A value4)
java.util.Arrays.asList()
, but truely immutable.public static <A,B> Map<A,B> asGraph(Function<? super A,? extends B> fun, Set<? extends A> things)
public static <A,B,C> Map<A,C> mapWithKey(Function<? super Map.Entry<A,B>,? extends C> fun, Map<A,B> things)
public static <A,B,C> Map<A,C> mapWithKey(BiFunction<? super A,? super B,? extends C> fun, Map<A,B> things)
public static <A,B,C> Function<Map.Entry<A,B>,Map.Entry<A,C>> mapEntry(Function<? super B,? extends C> fun)
public static <A,B,C> Function<Map.Entry<A,B>,Map.Entry<A,C>> mapEntryWithKey(Function<? super Map.Entry<A,B>,? extends C> fun)
public static <A,B,C> Map<B,C> toSpan(Function<? super A,? extends B> left, Function<? super A,? extends C> right, Collection<? extends A> gen)
public static <A,B> Map<A,B> toGraph(Function<? super A,? extends B> fun, Set<? extends A> dom)
public static <A> Collection<A> concat(Collection<? extends A> some, Collection<? extends A> other)
public static <A> Set<A> union(Collection<? extends A> some, Collection<? extends A> other)
public static <A> Set<A> setminus(Collection<? extends A> some, Collection<? extends A> other)
public static <A> Set<A> intersection(Collection<? extends A> some, Collection<? extends A> other)
public static final <T> BiFunction<Set<T>,Set<T>,Set<T>> intersectionF()
public static final <T> BiFunction<Set<T>,Set<T>,Set<T>> unionF()
public static final <T> BiFunction<T,T,T> otherwise()
public static <A> Collection<A> flatten(Collection<? extends Collection<A>> colls)
public static <K,V> Map.Entry<K,V> unmodifiableEntry(Map.Entry<? extends K,? extends V> entry)
public static <K,V> Map.Entry<K,V> entry(K key, V value)
public static <A,B> B fold(GenSemigroup<? super A,B> grp, Collection<? extends A> things)
public static <A,B> B fold(GenMonoid<? super A,B> mon, Collection<? extends A> things)
public static <A> Set<A> elements(Collection<? extends A> things)
public static <A> SortedSet<A> elements(Collection<? extends A> things, Comparator<? super A> comparator)
public static <A,B,C extends B> Map<A,B> castValues(Class<? extends C> cls, Map<A,C> things)
public static <A,B> Collections.LiteralMap<A,B> literalMap()
public static <A,B> Collections.LiteralMap<A,B> literalMap(A key, B value)
public static <A,B> Collections.LiteralMap<A,B> literalMap(A key1, B value1, A key2, B value2)
public static <A,B> Collections.LiteralMap<A,B> literalMap(A key1, B value1, A key2, B value2, A key3, B value3)
public static <A,B> Collections.LiteralMap<A,B> literalMap(A key1, B value1, A key2, B value2, A key3, B value3, A key4, B value4)
public static <A> SortedSet<A> emptySortedSet()
public static <A extends Comparable<? super A>> SortedSet<A> singletonSortedSet(A elem)
public static <A> SortedSet<A> singletonSortedSet(Comparator<? super A> comparator, A elem)
public static <A,B> SortedMap<A,B> emptySortedMap()
public static <A extends Comparable<? super A>,B> SortedMap<A,B> singletonSortedMap(A key, B value)
public static <A,B> SortedMap<A,B> singletonSortedMap(Comparator<? super A> comparator, A key, B value)
see also the complete user documentation .