Class SeqImpl<T>

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Iterable<T>, java.util.stream.BaseStream<T,​java.util.stream.Stream<T>>, java.util.stream.Stream<T>, Collectable<T>, Seq<T>

    class SeqImpl<T>
    extends java.lang.Object
    implements Seq<T>
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.stream.Stream

        java.util.stream.Stream.Builder<T extends java.lang.Object>
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.Object[] buffered  
      (package private) static java.lang.Object NULL  
      private java.util.stream.Stream<? extends T> stream  
    • Constructor Summary

      Constructors 
      Constructor Description
      SeqImpl​(java.util.stream.Stream<? extends T> stream)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allMatch​(java.util.function.Predicate<? super T> predicate)
      Whether all elements in the collectable match a given predicate.
      boolean anyMatch​(java.util.function.Predicate<? super T> predicate)
      Whether any element in the collectable matches a given predicate.
      java.util.Optional<T> avg()
      Get the average of the elements in this collectable.
      <U> java.util.Optional<U> avg​(java.util.function.Function<? super T,​? extends U> function)
      Get the average of the elements in this collectable.
      double avgDouble​(java.util.function.ToDoubleFunction<? super T> function)
      Get the average of the elements in this collectable as double.
      double avgInt​(java.util.function.ToIntFunction<? super T> function)
      Get the average of the elements in this collectable as int.
      double avgLong​(java.util.function.ToLongFunction<? super T> function)
      Get the average of the elements in this collectable as long.
      java.util.Optional<T> bitAnd()
      Collect all bits in this stream into a single value by applying bitwise and.
      <U> java.util.Optional<U> bitAnd​(java.util.function.Function<? super T,​? extends U> function)
      Collect all bits in this stream into a single value by applying bitwise and.
      int bitAndInt​(java.util.function.ToIntFunction<? super T> function)
      Collect all bits in this stream into a single value by applying bitwise and.
      long bitAndLong​(java.util.function.ToLongFunction<? super T> function)
      Collect all bits in this stream into a single value by applying bitwise and.
      java.util.Optional<T> bitOr()
      Collect all bits in this stream into a single value by applying bitwise or.
      <U> java.util.Optional<U> bitOr​(java.util.function.Function<? super T,​? extends U> function)
      Collect all bits in this stream into a single value by applying bitwise or.
      int bitOrInt​(java.util.function.ToIntFunction<? super T> function)
      Collect all bits in this stream into a single value by applying bitwise or.
      long bitOrLong​(java.util.function.ToLongFunction<? super T> function)
      Collect all bits in this stream into a single value by applying bitwise or.
      void close()  
      <R> R collect​(java.util.function.Supplier<R> supplier, java.util.function.BiConsumer<R,​? super T> accumulator, java.util.function.BiConsumer<R,​R> combiner)  
      <R,​A>
      R
      collect​(java.util.stream.Collector<? super T,​A,​R> collector)
      Collect this collectable.
      java.lang.String commonPrefix()
      Get the common prefix of all strings (or to-stringed values) in this stream.
      java.lang.String commonSuffix()
      Get the common prefix of all strings (or to-stringed values) in this stream.
      long count()
      Count the values in this collectable.
      long count​(java.util.function.Predicate<? super T> predicate)
      Count the values in this collectable, for which a predicate evaluates to true.
      long countDistinct()
      Count the distinct values in this collectable.
      long countDistinct​(java.util.function.Predicate<? super T> predicate)
      Count the distinct values in this collectable, for which a predicate evaluates to true.
      <U> long countDistinctBy​(java.util.function.Function<? super T,​? extends U> function)
      Count the distinct values of a given expression in this collectable.
      <U> long countDistinctBy​(java.util.function.Function<? super T,​? extends U> function, java.util.function.Predicate<? super U> predicate)
      Count the distinct values of a given expression in this collectable, for which a predicate evaluates to true.
      Seq<T> distinct()  
      Seq<T> filter​(java.util.function.Predicate<? super T> predicate)  
      java.util.Optional<T> findAny()  
      java.util.Optional<T> findFirst()  
      <R> Seq<R> flatMap​(java.util.function.Function<? super T,​? extends java.util.stream.Stream<? extends R>> mapper)  
      java.util.stream.DoubleStream flatMapToDouble​(java.util.function.Function<? super T,​? extends java.util.stream.DoubleStream> mapper)  
      java.util.stream.IntStream flatMapToInt​(java.util.function.Function<? super T,​? extends java.util.stream.IntStream> mapper)  
      java.util.stream.LongStream flatMapToLong​(java.util.function.Function<? super T,​? extends java.util.stream.LongStream> mapper)  
      void forEach​(java.util.function.Consumer<? super T> action)  
      void forEachOrdered​(java.util.function.Consumer<? super T> action)  
      java.lang.String format()
      Generate a nicely formatted representation of this stream.
      boolean isParallel()
      Always returns false.
      java.util.Iterator<T> iterator()  
      Seq<T> limit​(long maxSize)  
      <R> Seq<R> map​(java.util.function.Function<? super T,​? extends R> mapper)  
      java.util.stream.DoubleStream mapToDouble​(java.util.function.ToDoubleFunction<? super T> mapper)  
      java.util.stream.IntStream mapToInt​(java.util.function.ToIntFunction<? super T> mapper)  
      java.util.stream.LongStream mapToLong​(java.util.function.ToLongFunction<? super T> mapper)  
      java.util.Optional<T> max()
      Get the maximum value.
      java.util.Optional<T> max​(java.util.Comparator<? super T> comparator)
      Get the maximum value by a function.
      <U extends java.lang.Comparable<? super U>>
      java.util.Optional<U>
      max​(java.util.function.Function<? super T,​? extends U> function)
      Get the maximum value by a function.
      <U> java.util.Optional<U> max​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the maximum value by a function.
      Seq<T> maxAll()
      Get the maximum values.
      Seq<T> maxAll​(java.util.Comparator<? super T> comparator)
      Get the maximum values by a function.
      <U extends java.lang.Comparable<? super U>>
      Seq<U>
      maxAll​(java.util.function.Function<? super T,​? extends U> function)
      Get the maximum values by a function.
      <U> Seq<U> maxAll​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the maximum values by a function.
      <U extends java.lang.Comparable<? super U>>
      Seq<T>
      maxAllBy​(java.util.function.Function<? super T,​? extends U> function)
      Get the maximum values by a function.
      <U> Seq<T> maxAllBy​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the maximum values by a function.
      <U extends java.lang.Comparable<? super U>>
      java.util.Optional<T>
      maxBy​(java.util.function.Function<? super T,​? extends U> function)
      Get the maximum value by a function.
      <U> java.util.Optional<T> maxBy​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the maximum value by a function.
      java.util.Optional<T> median()
      Get the median value.
      java.util.Optional<T> median​(java.util.Comparator<? super T> comparator)
      Get the median value.
      <U extends java.lang.Comparable<? super U>>
      java.util.Optional<T>
      medianBy​(java.util.function.Function<? super T,​? extends U> function)
      Get the median value by a function.
      <U> java.util.Optional<T> medianBy​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the median value by a function.
      java.util.Optional<T> min()
      Get the minimum value.
      java.util.Optional<T> min​(java.util.Comparator<? super T> comparator)
      Get the minimum value by a function.
      <U extends java.lang.Comparable<? super U>>
      java.util.Optional<U>
      min​(java.util.function.Function<? super T,​? extends U> function)
      Get the minimum value by a function.
      <U> java.util.Optional<U> min​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the minimum value by a function.
      Seq<T> minAll()
      Get the minimum values.
      Seq<T> minAll​(java.util.Comparator<? super T> comparator)
      Get the minimum values by a function.
      <U extends java.lang.Comparable<? super U>>
      Seq<U>
      minAll​(java.util.function.Function<? super T,​? extends U> function)
      Get the minimum values by a function.
      <U> Seq<U> minAll​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the minimum values by a function.
      <U extends java.lang.Comparable<? super U>>
      Seq<T>
      minAllBy​(java.util.function.Function<? super T,​? extends U> function)
      Get the minimum values by a function.
      <U> Seq<T> minAllBy​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the minimum values by a function.
      <U extends java.lang.Comparable<? super U>>
      java.util.Optional<T>
      minBy​(java.util.function.Function<? super T,​? extends U> function)
      Get the minimum value by a function.
      <U> java.util.Optional<T> minBy​(java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the minimum value by a function.
      java.util.Optional<T> mode()
      Get the mode, i.e.
      Seq<T> modeAll()
      Get the mode, i.e.
      <U> Seq<T> modeAllBy​(java.util.function.Function<? super T,​? extends U> function)
      Get the mode, i.e.
      <U> java.util.Optional<T> modeBy​(java.util.function.Function<? super T,​? extends U> function)
      Get the mode, i.e.
      boolean noneMatch​(java.util.function.Predicate<? super T> predicate)
      Whether no element in the collectable matches a given predicate.
      Seq<T> onClose​(java.lang.Runnable closeHandler)  
      Seq<T> peek​(java.util.function.Consumer<? super T> action)  
      java.util.Optional<T> percentile​(double percentile)
      Get the discrete percentile value.
      java.util.Optional<T> percentile​(double percentile, java.util.Comparator<? super T> comparator)
      Get the discrete percentile value.
      <U extends java.lang.Comparable<? super U>>
      java.util.Optional<T>
      percentileBy​(double percentile, java.util.function.Function<? super T,​? extends U> function)
      Get the discrete percentile value by a function.
      <U> java.util.Optional<T> percentileBy​(double percentile, java.util.function.Function<? super T,​? extends U> function, java.util.Comparator<? super U> comparator)
      Get the discrete percentile value by a function.
      java.util.Optional<T> reduce​(java.util.function.BinaryOperator<T> accumulator)  
      T reduce​(T identity, java.util.function.BinaryOperator<T> accumulator)  
      <U> U reduce​(U identity, java.util.function.BiFunction<U,​? super T,​U> accumulator, java.util.function.BinaryOperator<U> combiner)  
      Seq<T> skip​(long n)  
      Seq<T> sorted()  
      Seq<T> sorted​(java.util.Comparator<? super T> comparator)  
      java.util.Spliterator<T> spliterator()  
      java.util.stream.Stream<T> stream()
      The underlying Stream implementation.
      java.util.Optional<T> sum()
      Get the sum of the elements in this collectable.
      <U> java.util.Optional<U> sum​(java.util.function.Function<? super T,​? extends U> function)
      Get the sum of the elements in this collectable.
      double sumDouble​(java.util.function.ToDoubleFunction<? super T> function)
      Get the sum of the elements in this collectable as double.
      int sumInt​(java.util.function.ToIntFunction<? super T> function)
      Get the sum of the elements in this collectable as int.
      long sumLong​(java.util.function.ToLongFunction<? super T> function)
      Get the sum of the elements in this collectable as long.
      java.lang.Object[] toArray()  
      <A> A[] toArray​(java.util.function.IntFunction<A[]> generator)  
      <C extends java.util.Collection<T>>
      C
      toCollection​(java.util.function.Supplier<C> factory)
      Collect the collectable into a Collection.
      java.util.List<T> toList()
      Collect the collectable into an ArrayList.
      <L extends java.util.List<T>>
      L
      toList​(java.util.function.Supplier<L> factory)
      Collect the collectable into a List.
      <K> java.util.Map<K,​T> toMap​(java.util.function.Function<? super T,​? extends K> keyMapper)
      Collect the collectable into a Map with the given keys and the self element as value.
      <K,​V>
      java.util.Map<K,​V>
      toMap​(java.util.function.Function<? super T,​? extends K> keyMapper, java.util.function.Function<? super T,​? extends V> valueMapper)
      Collect the collectable into a Map.
      java.util.Set<T> toSet()
      Collect the collectable into a LinkedHashSet.
      <S extends java.util.Set<T>>
      S
      toSet​(java.util.function.Supplier<S> factory)
      Collect the collectable into a Set.
      java.lang.String toString()  
      java.lang.String toString​(java.lang.CharSequence delimiter)
      Consume a stream and concatenate all elements using a separator.
      java.lang.String toString​(java.lang.CharSequence delimiter, java.lang.CharSequence prefix, java.lang.CharSequence suffix)
      Shortcut for calling Stream.collect(Collector) with a Collectors.joining(CharSequence, CharSequence, CharSequence) collector.
      java.util.List<T> toUnmodifiableList()
      Collect the collectable into an unmodifiable List.
      java.util.Set<T> toUnmodifiableSet()
      Collect the collectable into an unmodifiable Set.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.stream.Stream

        dropWhile, takeWhile
    • Field Detail

      • NULL

        static final java.lang.Object NULL
      • stream

        private final java.util.stream.Stream<? extends T> stream
      • buffered

        private java.lang.Object[] buffered
    • Constructor Detail

      • SeqImpl

        SeqImpl​(java.util.stream.Stream<? extends T> stream)
    • Method Detail

      • stream

        public java.util.stream.Stream<T> stream()
        Description copied from interface: Seq
        The underlying Stream implementation.
        Specified by:
        stream in interface Seq<T>
      • filter

        public Seq<T> filter​(java.util.function.Predicate<? super T> predicate)
        Specified by:
        filter in interface Seq<T>
        Specified by:
        filter in interface java.util.stream.Stream<T>
      • map

        public <R> Seq<R> map​(java.util.function.Function<? super T,​? extends R> mapper)
        Specified by:
        map in interface Seq<T>
        Specified by:
        map in interface java.util.stream.Stream<T>
      • mapToInt

        public java.util.stream.IntStream mapToInt​(java.util.function.ToIntFunction<? super T> mapper)
        Specified by:
        mapToInt in interface Seq<T>
        Specified by:
        mapToInt in interface java.util.stream.Stream<T>
      • mapToLong

        public java.util.stream.LongStream mapToLong​(java.util.function.ToLongFunction<? super T> mapper)
        Specified by:
        mapToLong in interface Seq<T>
        Specified by:
        mapToLong in interface java.util.stream.Stream<T>
      • mapToDouble

        public java.util.stream.DoubleStream mapToDouble​(java.util.function.ToDoubleFunction<? super T> mapper)
        Specified by:
        mapToDouble in interface Seq<T>
        Specified by:
        mapToDouble in interface java.util.stream.Stream<T>
      • flatMap

        public <R> Seq<R> flatMap​(java.util.function.Function<? super T,​? extends java.util.stream.Stream<? extends R>> mapper)
        Specified by:
        flatMap in interface Seq<T>
        Specified by:
        flatMap in interface java.util.stream.Stream<T>
      • flatMapToInt

        public java.util.stream.IntStream flatMapToInt​(java.util.function.Function<? super T,​? extends java.util.stream.IntStream> mapper)
        Specified by:
        flatMapToInt in interface Seq<T>
        Specified by:
        flatMapToInt in interface java.util.stream.Stream<T>
      • flatMapToLong

        public java.util.stream.LongStream flatMapToLong​(java.util.function.Function<? super T,​? extends java.util.stream.LongStream> mapper)
        Specified by:
        flatMapToLong in interface Seq<T>
        Specified by:
        flatMapToLong in interface java.util.stream.Stream<T>
      • flatMapToDouble

        public java.util.stream.DoubleStream flatMapToDouble​(java.util.function.Function<? super T,​? extends java.util.stream.DoubleStream> mapper)
        Specified by:
        flatMapToDouble in interface Seq<T>
        Specified by:
        flatMapToDouble in interface java.util.stream.Stream<T>
      • distinct

        public Seq<T> distinct()
        Specified by:
        distinct in interface Seq<T>
        Specified by:
        distinct in interface java.util.stream.Stream<T>
      • sorted

        public Seq<T> sorted()
        Specified by:
        sorted in interface Seq<T>
        Specified by:
        sorted in interface java.util.stream.Stream<T>
      • sorted

        public Seq<T> sorted​(java.util.Comparator<? super T> comparator)
        Specified by:
        sorted in interface Seq<T>
        Specified by:
        sorted in interface java.util.stream.Stream<T>
      • peek

        public Seq<T> peek​(java.util.function.Consumer<? super T> action)
        Specified by:
        peek in interface Seq<T>
        Specified by:
        peek in interface java.util.stream.Stream<T>
      • limit

        public Seq<T> limit​(long maxSize)
        Specified by:
        limit in interface Seq<T>
        Specified by:
        limit in interface java.util.stream.Stream<T>
      • skip

        public Seq<T> skip​(long n)
        Specified by:
        skip in interface Seq<T>
        Specified by:
        skip in interface java.util.stream.Stream<T>
      • forEach

        public void forEach​(java.util.function.Consumer<? super T> action)
        Specified by:
        forEach in interface java.lang.Iterable<T>
        Specified by:
        forEach in interface Seq<T>
        Specified by:
        forEach in interface java.util.stream.Stream<T>
      • forEachOrdered

        public void forEachOrdered​(java.util.function.Consumer<? super T> action)
        Specified by:
        forEachOrdered in interface java.util.stream.Stream<T>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.stream.Stream<T>
      • toArray

        public <A> A[] toArray​(java.util.function.IntFunction<A[]> generator)
        Specified by:
        toArray in interface java.util.stream.Stream<T>
      • reduce

        public T reduce​(T identity,
                        java.util.function.BinaryOperator<T> accumulator)
        Specified by:
        reduce in interface java.util.stream.Stream<T>
      • reduce

        public java.util.Optional<T> reduce​(java.util.function.BinaryOperator<T> accumulator)
        Specified by:
        reduce in interface java.util.stream.Stream<T>
      • reduce

        public <U> U reduce​(U identity,
                            java.util.function.BiFunction<U,​? super T,​U> accumulator,
                            java.util.function.BinaryOperator<U> combiner)
        Specified by:
        reduce in interface java.util.stream.Stream<T>
      • collect

        public <R> R collect​(java.util.function.Supplier<R> supplier,
                             java.util.function.BiConsumer<R,​? super T> accumulator,
                             java.util.function.BiConsumer<R,​R> combiner)
        Specified by:
        collect in interface java.util.stream.Stream<T>
      • collect

        public <R,​A> R collect​(java.util.stream.Collector<? super T,​A,​R> collector)
        Description copied from interface: Collectable
        Collect this collectable.
        Specified by:
        collect in interface Collectable<T>
        Specified by:
        collect in interface java.util.stream.Stream<T>
      • count

        public long count()
        Description copied from interface: Collectable
        Count the values in this collectable.
        Specified by:
        count in interface Collectable<T>
        Specified by:
        count in interface Seq<T>
        Specified by:
        count in interface java.util.stream.Stream<T>
      • count

        public long count​(java.util.function.Predicate<? super T> predicate)
        Description copied from interface: Collectable
        Count the values in this collectable, for which a predicate evaluates to true.
        Specified by:
        count in interface Collectable<T>
      • countDistinct

        public long countDistinct()
        Description copied from interface: Collectable
        Count the distinct values in this collectable.
        Specified by:
        countDistinct in interface Collectable<T>
      • countDistinct

        public long countDistinct​(java.util.function.Predicate<? super T> predicate)
        Description copied from interface: Collectable
        Count the distinct values in this collectable, for which a predicate evaluates to true.
        Specified by:
        countDistinct in interface Collectable<T>
      • countDistinctBy

        public <U> long countDistinctBy​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Count the distinct values of a given expression in this collectable.
        Specified by:
        countDistinctBy in interface Collectable<T>
      • countDistinctBy

        public <U> long countDistinctBy​(java.util.function.Function<? super T,​? extends U> function,
                                        java.util.function.Predicate<? super U> predicate)
        Description copied from interface: Collectable
        Count the distinct values of a given expression in this collectable, for which a predicate evaluates to true.
        Specified by:
        countDistinctBy in interface Collectable<T>
      • sum

        public java.util.Optional<T> sum()
        Description copied from interface: Collectable
        Get the sum of the elements in this collectable.
        Specified by:
        sum in interface Collectable<T>
      • sum

        public <U> java.util.Optional<U> sum​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the sum of the elements in this collectable.
        Specified by:
        sum in interface Collectable<T>
      • sumInt

        public int sumInt​(java.util.function.ToIntFunction<? super T> function)
        Description copied from interface: Collectable
        Get the sum of the elements in this collectable as int.
        Specified by:
        sumInt in interface Collectable<T>
      • sumLong

        public long sumLong​(java.util.function.ToLongFunction<? super T> function)
        Description copied from interface: Collectable
        Get the sum of the elements in this collectable as long.
        Specified by:
        sumLong in interface Collectable<T>
      • sumDouble

        public double sumDouble​(java.util.function.ToDoubleFunction<? super T> function)
        Description copied from interface: Collectable
        Get the sum of the elements in this collectable as double.
        Specified by:
        sumDouble in interface Collectable<T>
      • avg

        public java.util.Optional<T> avg()
        Description copied from interface: Collectable
        Get the average of the elements in this collectable.
        Specified by:
        avg in interface Collectable<T>
      • avg

        public <U> java.util.Optional<U> avg​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the average of the elements in this collectable.
        Specified by:
        avg in interface Collectable<T>
      • avgInt

        public double avgInt​(java.util.function.ToIntFunction<? super T> function)
        Description copied from interface: Collectable
        Get the average of the elements in this collectable as int.
        Specified by:
        avgInt in interface Collectable<T>
      • avgLong

        public double avgLong​(java.util.function.ToLongFunction<? super T> function)
        Description copied from interface: Collectable
        Get the average of the elements in this collectable as long.
        Specified by:
        avgLong in interface Collectable<T>
      • avgDouble

        public double avgDouble​(java.util.function.ToDoubleFunction<? super T> function)
        Description copied from interface: Collectable
        Get the average of the elements in this collectable as double.
        Specified by:
        avgDouble in interface Collectable<T>
      • min

        public java.util.Optional<T> min()
        Description copied from interface: Collectable
        Get the minimum value.

        This makes the unsafe assumption that <T extends Comparable<? super T>>

        Specified by:
        min in interface Collectable<T>
      • min

        public java.util.Optional<T> min​(java.util.Comparator<? super T> comparator)
        Description copied from interface: Collectable
        Get the minimum value by a function.
        Specified by:
        min in interface Collectable<T>
        Specified by:
        min in interface java.util.stream.Stream<T>
      • min

        public <U extends java.lang.Comparable<? super U>> java.util.Optional<U> min​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the minimum value by a function.
        Specified by:
        min in interface Collectable<T>
      • min

        public <U> java.util.Optional<U> min​(java.util.function.Function<? super T,​? extends U> function,
                                             java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the minimum value by a function.
        Specified by:
        min in interface Collectable<T>
      • minBy

        public <U extends java.lang.Comparable<? super U>> java.util.Optional<T> minBy​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the minimum value by a function.
        Specified by:
        minBy in interface Collectable<T>
      • minBy

        public <U> java.util.Optional<T> minBy​(java.util.function.Function<? super T,​? extends U> function,
                                               java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the minimum value by a function.
        Specified by:
        minBy in interface Collectable<T>
      • minAll

        public Seq<T> minAll()
        Description copied from interface: Collectable
        Get the minimum values.

        This makes the unsafe assumption that <T extends Comparable<? super T>>

        Specified by:
        minAll in interface Collectable<T>
      • minAll

        public Seq<T> minAll​(java.util.Comparator<? super T> comparator)
        Description copied from interface: Collectable
        Get the minimum values by a function.
        Specified by:
        minAll in interface Collectable<T>
      • minAll

        public <U extends java.lang.Comparable<? super U>> Seq<U> minAll​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the minimum values by a function.
        Specified by:
        minAll in interface Collectable<T>
      • minAll

        public <U> Seq<U> minAll​(java.util.function.Function<? super T,​? extends U> function,
                                 java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the minimum values by a function.
        Specified by:
        minAll in interface Collectable<T>
      • minAllBy

        public <U extends java.lang.Comparable<? super U>> Seq<T> minAllBy​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the minimum values by a function.
        Specified by:
        minAllBy in interface Collectable<T>
      • minAllBy

        public <U> Seq<T> minAllBy​(java.util.function.Function<? super T,​? extends U> function,
                                   java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the minimum values by a function.
        Specified by:
        minAllBy in interface Collectable<T>
      • max

        public java.util.Optional<T> max()
        Description copied from interface: Collectable
        Get the maximum value.

        This makes the unsafe assumption that <T extends Comparable<? super T>>

        Specified by:
        max in interface Collectable<T>
      • max

        public java.util.Optional<T> max​(java.util.Comparator<? super T> comparator)
        Description copied from interface: Collectable
        Get the maximum value by a function.
        Specified by:
        max in interface Collectable<T>
        Specified by:
        max in interface java.util.stream.Stream<T>
      • max

        public <U extends java.lang.Comparable<? super U>> java.util.Optional<U> max​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the maximum value by a function.
        Specified by:
        max in interface Collectable<T>
      • max

        public <U> java.util.Optional<U> max​(java.util.function.Function<? super T,​? extends U> function,
                                             java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the maximum value by a function.
        Specified by:
        max in interface Collectable<T>
      • maxBy

        public <U extends java.lang.Comparable<? super U>> java.util.Optional<T> maxBy​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the maximum value by a function.
        Specified by:
        maxBy in interface Collectable<T>
      • maxBy

        public <U> java.util.Optional<T> maxBy​(java.util.function.Function<? super T,​? extends U> function,
                                               java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the maximum value by a function.
        Specified by:
        maxBy in interface Collectable<T>
      • maxAll

        public Seq<T> maxAll()
        Description copied from interface: Collectable
        Get the maximum values.

        This makes the unsafe assumption that <T extends Comparable<? super T>>

        Specified by:
        maxAll in interface Collectable<T>
      • maxAll

        public Seq<T> maxAll​(java.util.Comparator<? super T> comparator)
        Description copied from interface: Collectable
        Get the maximum values by a function.
        Specified by:
        maxAll in interface Collectable<T>
      • maxAll

        public <U extends java.lang.Comparable<? super U>> Seq<U> maxAll​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the maximum values by a function.
        Specified by:
        maxAll in interface Collectable<T>
      • maxAll

        public <U> Seq<U> maxAll​(java.util.function.Function<? super T,​? extends U> function,
                                 java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the maximum values by a function.
        Specified by:
        maxAll in interface Collectable<T>
      • maxAllBy

        public <U extends java.lang.Comparable<? super U>> Seq<T> maxAllBy​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the maximum values by a function.
        Specified by:
        maxAllBy in interface Collectable<T>
      • maxAllBy

        public <U> Seq<T> maxAllBy​(java.util.function.Function<? super T,​? extends U> function,
                                   java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the maximum values by a function.
        Specified by:
        maxAllBy in interface Collectable<T>
      • median

        public java.util.Optional<T> median()
        Description copied from interface: Collectable
        Get the median value.

        This makes the unsafe assumption that <T extends Comparable<? super T>>

        Specified by:
        median in interface Collectable<T>
      • median

        public java.util.Optional<T> median​(java.util.Comparator<? super T> comparator)
        Description copied from interface: Collectable
        Get the median value.
        Specified by:
        median in interface Collectable<T>
      • medianBy

        public <U extends java.lang.Comparable<? super U>> java.util.Optional<T> medianBy​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the median value by a function.
        Specified by:
        medianBy in interface Collectable<T>
      • medianBy

        public <U> java.util.Optional<T> medianBy​(java.util.function.Function<? super T,​? extends U> function,
                                                  java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the median value by a function.
        Specified by:
        medianBy in interface Collectable<T>
      • percentile

        public java.util.Optional<T> percentile​(double percentile)
        Description copied from interface: Collectable
        Get the discrete percentile value.

        This makes the unsafe assumption that <T extends Comparable<? super T>>

        Specified by:
        percentile in interface Collectable<T>
      • percentile

        public java.util.Optional<T> percentile​(double percentile,
                                                java.util.Comparator<? super T> comparator)
        Description copied from interface: Collectable
        Get the discrete percentile value.
        Specified by:
        percentile in interface Collectable<T>
      • percentileBy

        public <U extends java.lang.Comparable<? super U>> java.util.Optional<T> percentileBy​(double percentile,
                                                                                              java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the discrete percentile value by a function.
        Specified by:
        percentileBy in interface Collectable<T>
      • percentileBy

        public <U> java.util.Optional<T> percentileBy​(double percentile,
                                                      java.util.function.Function<? super T,​? extends U> function,
                                                      java.util.Comparator<? super U> comparator)
        Description copied from interface: Collectable
        Get the discrete percentile value by a function.
        Specified by:
        percentileBy in interface Collectable<T>
      • mode

        public java.util.Optional<T> mode()
        Description copied from interface: Collectable
        Get the mode, i.e. the value that appears most often in the collectable.
        Specified by:
        mode in interface Collectable<T>
      • modeBy

        public <U> java.util.Optional<T> modeBy​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the mode, i.e. the value that appears most often in the collectable.
        Specified by:
        modeBy in interface Collectable<T>
      • modeAll

        public Seq<T> modeAll()
        Description copied from interface: Collectable
        Get the mode, i.e. the values that appear most often in the collectable.
        Specified by:
        modeAll in interface Collectable<T>
      • modeAllBy

        public <U> Seq<T> modeAllBy​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Get the mode, i.e. the values that appear most often in the collectable.
        Specified by:
        modeAllBy in interface Collectable<T>
      • anyMatch

        public boolean anyMatch​(java.util.function.Predicate<? super T> predicate)
        Description copied from interface: Collectable
        Whether any element in the collectable matches a given predicate.
        Specified by:
        anyMatch in interface Collectable<T>
        Specified by:
        anyMatch in interface java.util.stream.Stream<T>
      • allMatch

        public boolean allMatch​(java.util.function.Predicate<? super T> predicate)
        Description copied from interface: Collectable
        Whether all elements in the collectable match a given predicate.
        Specified by:
        allMatch in interface Collectable<T>
        Specified by:
        allMatch in interface java.util.stream.Stream<T>
      • noneMatch

        public boolean noneMatch​(java.util.function.Predicate<? super T> predicate)
        Description copied from interface: Collectable
        Whether no element in the collectable matches a given predicate.
        Specified by:
        noneMatch in interface Collectable<T>
        Specified by:
        noneMatch in interface java.util.stream.Stream<T>
      • bitAnd

        public java.util.Optional<T> bitAnd()
        Description copied from interface: Collectable
        Collect all bits in this stream into a single value by applying bitwise and.
        Specified by:
        bitAnd in interface Collectable<T>
      • bitAnd

        public <U> java.util.Optional<U> bitAnd​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Collect all bits in this stream into a single value by applying bitwise and.
        Specified by:
        bitAnd in interface Collectable<T>
      • bitAndInt

        public int bitAndInt​(java.util.function.ToIntFunction<? super T> function)
        Description copied from interface: Collectable
        Collect all bits in this stream into a single value by applying bitwise and.
        Specified by:
        bitAndInt in interface Collectable<T>
      • bitAndLong

        public long bitAndLong​(java.util.function.ToLongFunction<? super T> function)
        Description copied from interface: Collectable
        Collect all bits in this stream into a single value by applying bitwise and.
        Specified by:
        bitAndLong in interface Collectable<T>
      • bitOr

        public java.util.Optional<T> bitOr()
        Description copied from interface: Collectable
        Collect all bits in this stream into a single value by applying bitwise or.
        Specified by:
        bitOr in interface Collectable<T>
      • bitOr

        public <U> java.util.Optional<U> bitOr​(java.util.function.Function<? super T,​? extends U> function)
        Description copied from interface: Collectable
        Collect all bits in this stream into a single value by applying bitwise or.
        Specified by:
        bitOr in interface Collectable<T>
      • bitOrInt

        public int bitOrInt​(java.util.function.ToIntFunction<? super T> function)
        Description copied from interface: Collectable
        Collect all bits in this stream into a single value by applying bitwise or.
        Specified by:
        bitOrInt in interface Collectable<T>
      • bitOrLong

        public long bitOrLong​(java.util.function.ToLongFunction<? super T> function)
        Description copied from interface: Collectable
        Collect all bits in this stream into a single value by applying bitwise or.
        Specified by:
        bitOrLong in interface Collectable<T>
      • findFirst

        public java.util.Optional<T> findFirst()
        Specified by:
        findFirst in interface java.util.stream.Stream<T>
      • findAny

        public java.util.Optional<T> findAny()
        Specified by:
        findAny in interface java.util.stream.Stream<T>
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.util.stream.BaseStream<T,​java.util.stream.Stream<T>>
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • spliterator

        public java.util.Spliterator<T> spliterator()
        Specified by:
        spliterator in interface java.util.stream.BaseStream<T,​java.util.stream.Stream<T>>
        Specified by:
        spliterator in interface java.lang.Iterable<T>
        Specified by:
        spliterator in interface Seq<T>
      • isParallel

        public boolean isParallel()
        Always returns false. Seq streams are always sequential and, as such, doesn't support parallelization.
        Specified by:
        isParallel in interface java.util.stream.BaseStream<T,​java.util.stream.Stream<T>>
        Returns:
        false
        See Also:
        jOOL Issue #130
      • onClose

        public Seq<T> onClose​(java.lang.Runnable closeHandler)
        Specified by:
        onClose in interface java.util.stream.BaseStream<T,​java.util.stream.Stream<T>>
        Specified by:
        onClose in interface Seq<T>
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.util.stream.BaseStream<T,​java.util.stream.Stream<T>>
        Specified by:
        close in interface Seq<T>
      • toList

        public java.util.List<T> toList()
        Description copied from interface: Collectable
        Collect the collectable into an ArrayList.
        Specified by:
        toList in interface Collectable<T>
      • toList

        public <L extends java.util.List<T>> L toList​(java.util.function.Supplier<L> factory)
        Description copied from interface: Collectable
        Collect the collectable into a List.
        Specified by:
        toList in interface Collectable<T>
      • toUnmodifiableList

        public java.util.List<T> toUnmodifiableList()
        Description copied from interface: Collectable
        Collect the collectable into an unmodifiable List.
        Specified by:
        toUnmodifiableList in interface Collectable<T>
      • toSet

        public java.util.Set<T> toSet()
        Description copied from interface: Collectable
        Collect the collectable into a LinkedHashSet.
        Specified by:
        toSet in interface Collectable<T>
      • toSet

        public <S extends java.util.Set<T>> S toSet​(java.util.function.Supplier<S> factory)
        Description copied from interface: Collectable
        Collect the collectable into a Set.
        Specified by:
        toSet in interface Collectable<T>
      • toUnmodifiableSet

        public java.util.Set<T> toUnmodifiableSet()
        Description copied from interface: Collectable
        Collect the collectable into an unmodifiable Set.
        Specified by:
        toUnmodifiableSet in interface Collectable<T>
      • toCollection

        public <C extends java.util.Collection<T>> C toCollection​(java.util.function.Supplier<C> factory)
        Description copied from interface: Collectable
        Collect the collectable into a Collection.
        Specified by:
        toCollection in interface Collectable<T>
      • toMap

        public <K,​V> java.util.Map<K,​V> toMap​(java.util.function.Function<? super T,​? extends K> keyMapper,
                                                          java.util.function.Function<? super T,​? extends V> valueMapper)
        Description copied from interface: Collectable
        Collect the collectable into a Map.
        Specified by:
        toMap in interface Collectable<T>
      • toMap

        public <K> java.util.Map<K,​T> toMap​(java.util.function.Function<? super T,​? extends K> keyMapper)
        Description copied from interface: Collectable
        Collect the collectable into a Map with the given keys and the self element as value.
        Specified by:
        toMap in interface Collectable<T>
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toString

        public java.lang.String toString​(java.lang.CharSequence delimiter)
        Description copied from interface: Collectable
        Consume a stream and concatenate all elements using a separator.
        Specified by:
        toString in interface Collectable<T>
      • toString

        public java.lang.String toString​(java.lang.CharSequence delimiter,
                                         java.lang.CharSequence prefix,
                                         java.lang.CharSequence suffix)
        Description copied from interface: Collectable
        Shortcut for calling Stream.collect(Collector) with a Collectors.joining(CharSequence, CharSequence, CharSequence) collector.
        Specified by:
        toString in interface Collectable<T>
      • commonPrefix

        public java.lang.String commonPrefix()
        Description copied from interface: Collectable
        Get the common prefix of all strings (or to-stringed values) in this stream.
        Specified by:
        commonPrefix in interface Collectable<T>
      • commonSuffix

        public java.lang.String commonSuffix()
        Description copied from interface: Collectable
        Get the common prefix of all strings (or to-stringed values) in this stream.
        Specified by:
        commonSuffix in interface Collectable<T>
      • format

        public java.lang.String format()
        Description copied from interface: Seq
        Generate a nicely formatted representation of this stream.

        Clients should not rely on the concrete formatting of this method, which is intended for debugging convenience only.

        Specified by:
        format in interface Seq<T>