Package org.javimmutable.collections
Class ICollectors
java.lang.Object
org.javimmutable.collections.ICollectors
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
K> java.util.stream.Collector <T, ?, IListMap<K, T>> groupingBy
(java.util.function.Function<? super T, ? extends K> classifier) Collects values into a hashedIListMap
using the specified classifier function to generate keys from the encountered elements.static <T> java.util.stream.Collector
<T, ?, IArray<T>> toArray()
Collects values into aIArray
.static <T> java.util.stream.Collector
<T, ?, IDeque<T>> toDeque()
Collects values into a IDeque.static <T> java.util.stream.Collector
<T, ?, IList<T>> toList()
Efficiently collects values into aIList
built atop a balanced binary tree.toMap()
Creates a Collector suitable for use in the stream to produce a map.static <T> java.util.stream.Collector
<T, ?, IMultiset<T>> Collects into a multiset that sorts values based on the order they were originally added to the set.Creates a Collector suitable for use in the stream to produce an insert order map.static <T> java.util.stream.Collector
<T, ?, IMultiset<T>> Collects into a multiset that sorts values based on the order they were originally added to the set.static <T> java.util.stream.Collector
<T, ?, ISet<T>> Collects into a set that sorts values based on the order they were originally added to the set.static <T> java.util.stream.Collector
<T, ?, ISet<T>> toSet()
Collects into an unsorted set to the set.toSetMap()
static <K extends Comparable<K>,
V>
java.util.stream.Collector<IMapEntry<K, V>, ?, IListMap<K, V>> static <K extends Comparable<K>,
V>
java.util.stream.Collector<IMapEntry<K, V>, ?, IListMap<K, V>> toSortedListMap
(Comparator<K> comparator) static <K extends Comparable<K>,
V>
java.util.stream.Collector<IMapEntry<K, V>, ?, IMap<K, V>> Creates a Collector suitable for use in the stream to produce a sorted map.static <K extends Comparable<K>,
V>
java.util.stream.Collector<IMapEntry<K, V>, ?, IMap<K, V>> toSortedMap
(Comparator<K> comparator) Creates a Collector suitable for use in the stream to produce a sorted map.static <T extends Comparable<T>>
java.util.stream.Collector<T, ?, IMultiset<T>> Collects values into a sortedIMultiset
using natural sort order of elements.static <T> java.util.stream.Collector
<T, ?, IMultiset<T>> toSortedMultiset
(Comparator<T> comparator) Collects values into a sortedIMultiset
using specified Comparator.static <T extends Comparable<T>>
java.util.stream.Collector<T, ?, ISet<T>> Collects values into a sortedISet
using natural sort order of elements.static <T> java.util.stream.Collector
<T, ?, ISet<T>> toSortedSet
(Comparator<T> comparator) Collects values into a sortedISet
using specified Comparator.static <K extends Comparable<K>,
V>
java.util.stream.Collector<IMapEntry<K, V>, ?, ISetMap<K, V>> static <K extends Comparable<K>,
V>
java.util.stream.Collector<IMapEntry<K, V>, ?, ISetMap<K, V>> toSortedSetMap
(Comparator<K> comparator)
-
Method Details
-
toArray
Collects values into aIArray
. -
toDeque
Collects values into a IDeque. -
toList
Efficiently collects values into aIList
built atop a balanced binary tree. -
toListMap
-
toOrderedListMap
-
toSortedListMap
@Nonnull public static <K extends Comparable<K>,V> java.util.stream.Collector<IMapEntry<K,V>, toSortedListMap()?, IListMap<K, V>> -
toSortedListMap
@Nonnull public static <K extends Comparable<K>,V> java.util.stream.Collector<IMapEntry<K,V>, toSortedListMap?, IListMap<K, V>> (@Nonnull Comparator<K> comparator) -
toMap
Creates a Collector suitable for use in the stream to produce a map. -
toSortedMap
@Nonnull public static <K extends Comparable<K>,V> java.util.stream.Collector<IMapEntry<K,V>, toSortedMap()?, IMap<K, V>> Creates a Collector suitable for use in the stream to produce a sorted map. -
toSortedMap
@Nonnull public static <K extends Comparable<K>,V> java.util.stream.Collector<IMapEntry<K,V>, toSortedMap?, IMap<K, V>> (@Nonnull Comparator<K> comparator) Creates a Collector suitable for use in the stream to produce a sorted map. -
toOrderedMap
Creates a Collector suitable for use in the stream to produce an insert order map. -
toMultiset
Collects into a multiset that sorts values based on the order they were originally added to the set. -
toSortedMultiset
@Nonnull public static <T extends Comparable<T>> java.util.stream.Collector<T,?, toSortedMultiset()IMultiset<T>> Collects values into a sortedIMultiset
using natural sort order of elements. -
toSortedMultiset
@Nonnull public static <T> java.util.stream.Collector<T,?, toSortedMultisetIMultiset<T>> (@Nonnull Comparator<T> comparator) Collects values into a sortedIMultiset
using specified Comparator. -
toOrderedMultiset
Collects into a multiset that sorts values based on the order they were originally added to the set. -
toSet
Collects into an unsorted set to the set. -
toSortedSet
@Nonnull public static <T extends Comparable<T>> java.util.stream.Collector<T,?, toSortedSet()ISet<T>> Collects values into a sortedISet
using natural sort order of elements. -
toSortedSet
@Nonnull public static <T> java.util.stream.Collector<T,?, toSortedSetISet<T>> (@Nonnull Comparator<T> comparator) Collects values into a sortedISet
using specified Comparator. -
toOrderedSet
Collects into a set that sorts values based on the order they were originally added to the set.Implementation note: The set will adopt a hash code collision strategy based on the first value assigned to the set. All values in the map must either implement Comparable (and be comparable to all other values in the set) or not implement Comparable. Attempting to use values some of which implement Comparable and some of which do not will lead to runtime errors. It is always safest to use homogeneous values in any set.
-
toSetMap
-
toOrderedSetMap
-
toSortedSetMap
@Nonnull public static <K extends Comparable<K>,V> java.util.stream.Collector<IMapEntry<K,V>, toSortedSetMap()?, ISetMap<K, V>> -
toSortedSetMap
@Nonnull public static <K extends Comparable<K>,V> java.util.stream.Collector<IMapEntry<K,V>, toSortedSetMap?, ISetMap<K, V>> (@Nonnull Comparator<K> comparator) -
groupingBy
@Nonnull public static <T,K> java.util.stream.Collector<T,?, groupingByIListMap<K, T>> (@Nonnull java.util.function.Function<? super T, ? extends K> classifier) Collects values into a hashedIListMap
using the specified classifier function to generate keys from the encountered elements.
-