Class ICollectors

java.lang.Object
org.javimmutable.collections.ICollectors

public final class ICollectors extends Object
  • Method Details

    • toArray

      @Nonnull public static <T> java.util.stream.Collector<T,?,IArray<T>> toArray()
      Collects values into a IArray.
    • toDeque

      @Nonnull public static <T> java.util.stream.Collector<T,?,IDeque<T>> toDeque()
      Collects values into a IDeque.
    • toList

      @Nonnull public static <T> java.util.stream.Collector<T,?,IList<T>> toList()
      Efficiently collects values into a IList built atop a balanced binary tree.
    • toListMap

      @Nonnull public static <K, V> java.util.stream.Collector<IMapEntry<K,V>,?,IListMap<K,V>> toListMap()
    • toOrderedListMap

      @Nonnull public static <K, V> java.util.stream.Collector<IMapEntry<K,V>,?,IListMap<K,V>> toOrderedListMap()
    • toSortedListMap

      @Nonnull public static <K extends Comparable<K>, V> java.util.stream.Collector<IMapEntry<K,V>,?,IListMap<K,V>> toSortedListMap()
    • toSortedListMap

      @Nonnull public static <K extends Comparable<K>, V> java.util.stream.Collector<IMapEntry<K,V>,?,IListMap<K,V>> toSortedListMap(@Nonnull Comparator<K> comparator)
    • toMap

      @Nonnull public static <K, V> java.util.stream.Collector<IMapEntry<K,V>,?,IMap<K,V>> 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>,?,IMap<K,V>> toSortedMap()
      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>,?,IMap<K,V>> toSortedMap(@Nonnull Comparator<K> comparator)
      Creates a Collector suitable for use in the stream to produce a sorted map.
    • toOrderedMap

      @Nonnull public static <K, V> java.util.stream.Collector<IMapEntry<K,V>,?,IMap<K,V>> toOrderedMap()
      Creates a Collector suitable for use in the stream to produce an insert order map.
    • toMultiset

      @Nonnull public static <T> java.util.stream.Collector<T,?,IMultiset<T>> 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,?,IMultiset<T>> toSortedMultiset()
      Collects values into a sorted IMultiset using natural sort order of elements.
    • toSortedMultiset

      @Nonnull public static <T> java.util.stream.Collector<T,?,IMultiset<T>> toSortedMultiset(@Nonnull Comparator<T> comparator)
      Collects values into a sorted IMultiset using specified Comparator.
    • toOrderedMultiset

      @Nonnull public static <T> java.util.stream.Collector<T,?,IMultiset<T>> toOrderedMultiset()
      Collects into a multiset that sorts values based on the order they were originally added to the set.
    • toSet

      @Nonnull public static <T> java.util.stream.Collector<T,?,ISet<T>> toSet()
      Collects into an unsorted set to the set.
    • toSortedSet

      @Nonnull public static <T extends Comparable<T>> java.util.stream.Collector<T,?,ISet<T>> toSortedSet()
      Collects values into a sorted ISet using natural sort order of elements.
    • toSortedSet

      @Nonnull public static <T> java.util.stream.Collector<T,?,ISet<T>> toSortedSet(@Nonnull Comparator<T> comparator)
      Collects values into a sorted ISet using specified Comparator.
    • toOrderedSet

      @Nonnull public static <T> java.util.stream.Collector<T,?,ISet<T>> 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

      @Nonnull public static <K, V> java.util.stream.Collector<IMapEntry<K,V>,?,ISetMap<K,V>> toSetMap()
    • toOrderedSetMap

      @Nonnull public static <K, V> java.util.stream.Collector<IMapEntry<K,V>,?,ISetMap<K,V>> toOrderedSetMap()
    • toSortedSetMap

      @Nonnull public static <K extends Comparable<K>, V> java.util.stream.Collector<IMapEntry<K,V>,?,ISetMap<K,V>> toSortedSetMap()
    • toSortedSetMap

      @Nonnull public static <K extends Comparable<K>, V> java.util.stream.Collector<IMapEntry<K,V>,?,ISetMap<K,V>> toSortedSetMap(@Nonnull Comparator<K> comparator)
    • groupingBy

      @Nonnull public static <T, K> java.util.stream.Collector<T,?,IListMap<K,T>> groupingBy(@Nonnull java.util.function.Function<? super T,? extends K> classifier)
      Collects values into a hashed IListMap using the specified classifier function to generate keys from the encountered elements.