Class FlowableCollectors


  • public class FlowableCollectors
    extends java.lang.Object
    Util class for creating different Collector(s) that are not part of the Java Collectors utils.
    Author:
    Filip Hrisafov
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.stream.Collector<T,​?,​java.util.List<T>> toListWithSize​(int size)
      Returns a Collector that accumulates the input elements into a new List The created list is list that has size as the initial capacity.
      static <T> java.util.stream.Collector<T,​?,​java.util.Set<T>> toSetWithSize​(int expectedSize)
      Returns a Collector that accumulates the input elements into a new Set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toListWithSize

        public static <T> java.util.stream.Collector<T,​?,​java.util.List<T>> toListWithSize​(int size)
        Returns a Collector that accumulates the input elements into a new List The created list is list that has size as the initial capacity.
        Type Parameters:
        T - the type of the input elements
        Returns:
        a Collector which collects all the input elements into a List, in encounter order
      • toSetWithSize

        public static <T> java.util.stream.Collector<T,​?,​java.util.Set<T>> toSetWithSize​(int expectedSize)
        Returns a Collector that accumulates the input elements into a new Set. The created set is a set that has size as the expected initial size (taking the load factor into consideration).
        Type Parameters:
        T - the type of the input elements
        Returns:
        a Collector which collects all the input elements into a Set