Module watamebot

Class StreamUtils

java.lang.Object
net.foxgenesis.util.StreamUtils

public final class StreamUtils extends Object
Utility class that contains helpful methods for Stream.
Author:
Ashley
  • Constructor Details

    • StreamUtils

      public StreamUtils()
  • Method Details

    • getEffectiveStream

      public static <T> Stream<T> getEffectiveStream(Collection<T> col)
      Returns a possibly parallel stream if the amount of items exceed 1024.
      Type Parameters:
      T - - stream type
      Parameters:
      col - - collection to get stream for
      Returns:
      Returns a Stream that will be possibly parallel if Collection.size() is greater than 1024. Otherwise returns a sequential stream
      See Also:
    • getEffectiveStream

      public static <T> Stream<T> getEffectiveStream(Stream<T> stream)
      Returns a possibly parallel stream if the amount of items exceed 1024.
      Type Parameters:
      T - - stream type
      Parameters:
      stream - - stream to use
      Returns:
      Returns a Stream that will be possibly parallel if Stream.count() is greater than 1024. Otherwise returns the input stream
      See Also: