java.lang.Object
net.foxgenesis.util.StreamUtils
Utility class that contains helpful methods for
Stream.- Author:
- Ashley
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Stream<T>getEffectiveStream(Collection<T> col) Returns a possibly parallel stream if the amount of items exceed 1024.static <T> Stream<T>getEffectiveStream(Stream<T> stream) Returns a possibly parallel stream if the amount of items exceed 1024.
-
Constructor Details
-
StreamUtils
public StreamUtils()
-
-
Method Details
-
getEffectiveStream
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
Streamthat will be possibly parallel ifCollection.size()is greater than 1024. Otherwise returns a sequential stream - See Also:
-
getEffectiveStream
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
Streamthat will be possibly parallel ifStream.count()is greater than 1024. Otherwise returns the input stream - See Also:
-