Class StreamUtils

java.lang.Object
org.openl.util.StreamUtils

public class StreamUtils extends Object
Set of utilities for Java Streams.
Author:
Yury Molchan
  • Constructor Details

    • StreamUtils

      public StreamUtils()
  • Method Details

    • toLinkedMap

      public static <T, K, U> Collector<T,?,Map<K,U>> toLinkedMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends U> valueMapper)
      To use with Java Streams to collect in in a map preserving the order of elements.
    • toTreeSet

      public static <T> Collector<T,?,Set<T>> toTreeSet(Comparator<? super T> comparator)
      To use with Java Streams to collect in tree set with custom order
    • fromIterator

      public static <T> Stream<T> fromIterator(Iterator<T> iterator)
      Transform iterator to stream.
      Type Parameters:
      T - type of elements
      Parameters:
      iterator - iterator to transform
      Returns:
      stream