Class FlowableCollectors


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

      • toListWithSize

        public static <T> Collector<T,​?,​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> Collector<T,​?,​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