Class VavrCollectors


  • public class VavrCollectors
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private VavrCollectors()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <T> java.util.stream.Collector<T,​?,​io.vavr.control.Option<T>> toOption()
      Returns a Collector that accumulates 0 or 1 input elements into an Option<T>.
      • Methods inherited from class java.lang.Object

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

      • VavrCollectors

        private VavrCollectors()
    • Method Detail

      • toOption

        public static <T> java.util.stream.Collector<T,​?,​io.vavr.control.Option<T>> toOption()
        Returns a Collector that accumulates 0 or 1 input elements into an Option<T>. The returned collector will throw IllegalStateException whenever 2 or more elements are present in a stream. Null elements are mapped to Option.none().
        Type Parameters:
        T - the collected type
        Returns:
        a Collector which collects 0 or 1 input elements into an Option<T>.