Package io.datarouter.scanner
Class ScannerStream<T>
java.lang.Object
io.datarouter.scanner.ScannerStream<T>
- All Implemented Interfaces:
AutoCloseable,BaseStream<T,Stream<T>>,Stream<T>
public class ScannerStream<T> extends Object implements Stream<T>
Wrapper around a Scanner to allow closing it without explicitly closing the Stream. Some operations do release
a native Stream that must still be closed if it isn't fully consumed.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.stream.Stream
Stream.Builder<T extends Object> -
Constructor Summary
Constructors Constructor Description ScannerStream(Scanner<T> scanner) -
Method Summary
Modifier and Type Method Description booleanallMatch(Predicate<? super T> predicate)booleananyMatch(Predicate<? super T> predicate)voidclose()<R> Rcollect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner)<R, A> Rcollect(Collector<? super T,A,R> collector)longcount()Stream<T>distinct()Stream<T>filter(Predicate<? super T> predicate)Optional<T>findAny()Optional<T>findFirst()<R> Stream<R>flatMap(Function<? super T,? extends Stream<? extends R>> mapper)DoubleStreamflatMapToDouble(Function<? super T,? extends DoubleStream> mapper)IntStreamflatMapToInt(Function<? super T,? extends IntStream> mapper)LongStreamflatMapToLong(Function<? super T,? extends LongStream> mapper)voidforEach(Consumer<? super T> action)voidforEachOrdered(Consumer<? super T> action)booleanisParallel()Iterator<T>iterator()Stream<T>limit(long limit)<R> Stream<R>map(Function<? super T,? extends R> mapper)DoubleStreammapToDouble(ToDoubleFunction<? super T> mapper)IntStreammapToInt(ToIntFunction<? super T> mapper)LongStreammapToLong(ToLongFunction<? super T> mapper)Optional<T>max(Comparator<? super T> comparator)Optional<T>min(Comparator<? super T> comparator)booleannoneMatch(Predicate<? super T> predicate)Stream<T>onClose(Runnable closeHandler)Stream<T>parallel()Stream<T>peek(Consumer<? super T> action)Optional<T>reduce(BinaryOperator<T> accumulator)Treduce(T identity, BinaryOperator<T> accumulator)<U> Ureduce(U identity, BiFunction<U,? super T,U> accumulator, BinaryOperator<U> combiner)Stream<T>sequential()Stream<T>skip(long numToSkip)Stream<T>sorted()Stream<T>sorted(Comparator<? super T> comparator)Spliterator<T>spliterator()Object[]toArray()<A> A[]toArray(IntFunction<A[]> generator)Stream<T>unordered()
-
Constructor Details
-
Method Details
-
iterator
- Specified by:
iteratorin interfaceBaseStream<T,Stream<T>>
-
spliterator
- Specified by:
spliteratorin interfaceBaseStream<T,Stream<T>>
-
isParallel
public boolean isParallel()- Specified by:
isParallelin interfaceBaseStream<T,Stream<T>>
-
sequential
- Specified by:
sequentialin interfaceBaseStream<T,Stream<T>>
-
parallel
- Specified by:
parallelin interfaceBaseStream<T,Stream<T>>
-
unordered
- Specified by:
unorderedin interfaceBaseStream<T,Stream<T>>
-
onClose
- Specified by:
onClosein interfaceBaseStream<T,Stream<T>>
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBaseStream<T,Stream<T>>
-
mapToInt
-
mapToLong
-
mapToDouble
- Specified by:
mapToDoublein interfaceStream<T>
-
distinct
-
filter
-
map
-
peek
-
limit
-
skip
-
sorted
-
sorted
-
anyMatch
-
allMatch
-
count
public long count() -
findAny
-
findFirst
-
forEach
-
forEachOrdered
- Specified by:
forEachOrderedin interfaceStream<T>
-
max
-
min
-
noneMatch
-
toArray
-
toArray
-
reduce
-
reduce
-
reduce
public <U> U reduce(U identity, BiFunction<U,? super T,U> accumulator, BinaryOperator<U> combiner) -
collect
public <R> R collect(Supplier<R> supplier, BiConsumer<R,? super T> accumulator, BiConsumer<R,R> combiner) -
collect
-
flatMap
-
flatMapToInt
- Specified by:
flatMapToIntin interfaceStream<T>
-
flatMapToLong
- Specified by:
flatMapToLongin interfaceStream<T>
-
flatMapToDouble
- Specified by:
flatMapToDoublein interfaceStream<T>
-