Package eu.bandm.tools.util.java
Class Collections
java.lang.Object
eu.bandm.tools.util.java.Collections
Library of constants and combinators for classes implementing
Collection
and
similars.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <A,
B> Map<A, B> static <A,
B> Collection<B> asMap
(Function<? super A, ? extends B> fun, Collection<? extends A> things) Deprecated, for removal: This API element is subject to removal in a future version.static <A,
B, C extends B>
Map<A,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> 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> void
doPairwise
(List<A> list, BiConsumer<A, A> code) Execute the given code to all neighouring pairs of elements.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> static <A> SortedSet<A>
static <K,
V> Map.Entry<K, V> entry
(K key, V value) static <A> Collection<A>
flatten
(Collection<? extends Collection<A>> colls) static <D> D
Return the highest member of the set which is less or equal the given value.static <D> D
infimumKey
(SortedMap<D, ?> map, D value) Return the highest key in the domain of the map which is less or equal the given value.static <A> Set<A>
intersection
(Collection<? extends A> some, Collection<? extends A> other) static <A> A
Return the last element in a list.static <A> List<A>
literalList
(A... values) Returns an unmodifiable list of the given elements.static <A,
B> Collections.MapBuilder<A, B> literalMap
(A a, B b) static <A> Set<A>
literalSet
(A... values) Returns an unmodifiable set of the given elements.static <A,
B> Collection<B> map
(Function<? super A, ? extends B> fun, Collection<? extends A> things) Deprecated, for removal: This API element is subject to removal in a future version.static <A,
B, C> Map.Entry<A, C> static <A,
B, C> Map<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 <A> Set<A>
setminus
(Collection<? extends A> some, Collection<? extends A> other) static <A extends Comparable<? super A>,
B>
SortedMap<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>>
SortedSet<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>
static <A> Set<A>
static <A> SortedSet<A>
static <A,
B> Map<A, B> static <A,
B> Collection<B> toMap
(Function<? super A, ? extends B> fun, Collection<? extends A> things) Deprecated, for removal: This API element is subject to removal in a future version.usejava.util.stream
instead; see the first example atCollectors
.static <A,
B> Set<B> Deprecated, for removal: This API element is subject to removal in a future version.usejava.util.stream
instead; see the first example atCollectors
.static <A,
B> SortedSet<B> toMap
(Function<? super A, ? extends B> fun, SortedSet<A> things, Comparator<? super B> comparator) Deprecated, for removal: This API element is subject to removal in a future version.usejava.util.stream
instead; see the first example atCollectors
.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 <K,
V> Map.Entry<K, V> unmodifiableEntry
(Map.Entry<? extends K, ? extends V> entry)
-
Method Details
-
toFilter
-
toFilter
-
toFilter
-
toFilter
-
the
-
some
-
map
@Deprecated(forRemoval=true) public static <A,B> Collection<B> map(Function<? super A, ? extends B> fun, Collection<? extends A> things) Deprecated, for removal: This API element is subject to removal in a future version. -
asMap
@Deprecated(forRemoval=true) public static <A,B> Collection<B> asMap(Function<? super A, ? extends B> fun, Collection<? extends A> things) Deprecated, for removal: This API element is subject to removal in a future version.usejava.util.stream
instead; see the first example atCollectors
. -
toMap
@Deprecated(forRemoval=true) public static <A,B> Collection<B> toMap(Function<? super A, ? extends B> fun, Collection<? extends A> things) Deprecated, for removal: This API element is subject to removal in a future version.usejava.util.stream
instead; see the first example atCollectors
. -
toMap
@Deprecated(forRemoval=true) public static <A,B> Set<B> toMap(Function<? super A, ? extends B> fun, Set<? extends A> things) Deprecated, for removal: This API element is subject to removal in a future version.usejava.util.stream
instead; see the first example atCollectors
. -
toMap
@Deprecated(forRemoval=true) public static <A,B> SortedSet<B> toMap(Function<? super A, ? extends B> fun, SortedSet<A> things, Comparator<? super B> comparator) Deprecated, for removal: This API element is subject to removal in a future version.usejava.util.stream
instead; see the first example atCollectors
. -
literalSet
Returns an unmodifiable set of the given elements. The competitorSet.of(Object[])
is not recommended due to its peculiar interface. -
literalList
Returns an unmodifiable list of the given elements. The competitorList.of(Object[])
is not recommended because it does not accept null values. -
map
-
asGraph
-
mapWithKey
-
mapWithKey
public static <A,B, Map<A,C> C> mapWithKey(BiFunction<? super A, ? super B, ? extends C> fun, Map<A, B> things) -
map
-
mapEntry
-
mapEntryWithKey
-
doFilterKey
-
doFilterValue
-
toSpan
public static <A,B, Map<B,C> C> toSpan(Function<? super A, ? extends B> left, Function<? super A, ? extends C> right, Collection<? extends A> gen) -
toGraph
-
concat
-
union
-
setminus
-
intersection
-
flatten
-
unmodifiableEntry
-
entry
-
elements
-
elements
public static <A> SortedSet<A> elements(Collection<? extends A> things, Comparator<? super A> comparator) -
castValues
-
literalMap
-
emptySortedSet
-
singletonSortedSet
-
singletonSortedSet
-
emptySortedMap
-
singletonSortedMap
public static <A extends Comparable<? super A>,B> SortedMap<A,B> singletonSortedMap(A key, B value) -
singletonSortedMap
public static <A,B> SortedMap<A,B> singletonSortedMap(Comparator<? super A> comparator, A key, B value) -
infimum
Return the highest member of the set which is less or equal the given value. -
infimumKey
Return the highest key in the domain of the map which is less or equal the given value. Please note that "aSortedSet.keySet()" is not a SortedSet, so this method is really necessary. -
converse
-
lastOf
Return the last element in a list. Assume the list is NOT empty. -
doPairwise
Execute the given code to all neighouring pairs of elements.
-
java.util.stream
instead; see the first example atCollectors
.