@ParametersAreNonnullByDefault public final class MoreStreams extends Object
Stream instances.| Modifier and Type | Method and Description |
|---|---|
static Optional<Integer> |
indexOf(Stream<?> stream,
Object value)
Finds the index of the given
value in the stream. |
static Optional<Integer> |
lastIndexOf(Stream<?> stream,
Object value)
Finds the last index of the given
value in the stream. |
static IntUnaryOperator |
reverseOrder(int startInclusive,
int endExclusive)
Returns an unary operator to iterates over an
IntStream in the reverse direction. |
static LongUnaryOperator |
reverseOrder(long startInclusive,
long endExclusive)
Returns an unary operator to iterates over an
LongStream in the reverse direction. |
static Optional<Integer> |
size(Stream<?> stream)
Returns the number of element in the
stream as an integer; |
@Nonnull public static Optional<Integer> indexOf(Stream<?> stream, Object value)
value in the stream.stream - the stream to search through for the objectvalue - the value to findOptional containing the index of the value within the stream, Optional.empty() if not
found@Nonnull public static Optional<Integer> lastIndexOf(Stream<?> stream, Object value)
value in the stream.stream - the stream to traverse for looking for the objectvalue - the value to find, may be nullOptional containing the index of the value within the stream, Optional.empty() if not
found@Nonnull public static Optional<Integer> size(Stream<?> stream)
stream as an integer;stream - the streamOptional containing the size, Optional.empty() if the stream is empty@Nonnull public static IntUnaryOperator reverseOrder(int startInclusive, int endExclusive)
IntStream in the reverse direction.startInclusive - the (inclusive) initial valueendExclusive - the exclusive upper boundIntStream.range(int, int)@Nonnull public static LongUnaryOperator reverseOrder(long startInclusive, long endExclusive)
LongStream in the reverse direction.startInclusive - the (inclusive) initial valueendExclusive - the exclusive upper boundLongStream.range(long, long)Copyright © 2017–2019 Atlanmod. All rights reserved.