Package | Description |
---|---|
java8.util |
Provides some of the new
java.util classes and implementations
of static and default interface methods added in Java 8. |
java8.util.stream |
Classes to support functional-style operations on streams of elements, such
as map-reduce transformations on collections.
|
Modifier and Type | Method and Description |
---|---|
Stream<T> |
Optional.stream()
If a value is present, returns a sequential
Stream containing
only that value, otherwise returns an empty Stream . |
static <T> Stream<T> |
J8Arrays.stream(T[] array)
Returns a sequential
Stream with the specified array as its
source. |
static <T> Stream<T> |
J8Arrays.stream(T[] array,
int startInclusive,
int endExclusive)
Returns a sequential
Stream with the specified range of the
specified array as its source. |
Modifier and Type | Method and Description |
---|---|
Stream<Long> |
LongStream.boxed()
Returns a
Stream consisting of the elements of this stream,
each boxed to a Long . |
Stream<Integer> |
IntStream.boxed()
Returns a
Stream consisting of the elements of this stream,
each boxed to an Integer . |
Stream<Double> |
DoubleStream.boxed()
Returns a
Stream consisting of the elements of this stream,
boxed to Double . |
Stream<T> |
Stream.Builder.build()
Builds the stream, transitioning this builder to the built state.
|
static <T> Stream<T> |
RefStreams.concat(Stream<? extends T> a,
Stream<? extends T> b)
Creates a lazily concatenated
Stream whose elements are all the
elements of the first stream followed by all the elements of the
second stream. |
Stream<T> |
Stream.distinct()
Returns a stream consisting of the distinct elements (according to
Object.equals(Object) ) of this stream. |
Stream<T> |
Stream.dropWhile(Predicate<? super T> predicate)
Returns, if this stream is ordered, a stream consisting of the remaining
elements of this stream after dropping the longest prefix of elements
that match the given predicate.
|
static <T> Stream<T> |
RefStreams.dropWhile(Stream<? extends T> stream,
Predicate<? super T> predicate)
Returns, if the passed stream is ordered, a stream consisting of the remaining
elements of the passed stream after dropping the longest prefix of elements
that match the given predicate.
|
static <T> Stream<T> |
RefStreams.empty()
Returns an empty sequential
Stream . |
Stream<T> |
Stream.filter(Predicate<? super T> predicate)
Returns a stream consisting of the elements of this stream that match
the given predicate.
|
<R> Stream<R> |
Stream.flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
|
static <T> Stream<T> |
RefStreams.generate(Supplier<? extends T> s)
Returns an infinite sequential unordered
Stream where each
element is generated by the provided Supplier . |
static <T,S extends T> |
RefStreams.iterate(S seed,
Predicate<S> predicate,
UnaryOperator<S> f)
Returns a sequential ordered
Stream produced by iterative
application of a function to an initial element, conditioned on
satisfying the supplied predicate. |
static <T,S extends T> |
RefStreams.iterate(S seed,
UnaryOperator<S> f)
Returns an infinite sequential ordered
Stream produced by iterative
application of a function f to an initial element seed ,
producing a Stream consisting of seed , f(seed) ,
f(f(seed)) , etc. |
Stream<T> |
Stream.limit(long maxSize)
Returns a stream consisting of the elements of this stream, truncated
to be no longer than
maxSize in length. |
<R> Stream<R> |
Stream.map(Function<? super T,? extends R> mapper)
Returns a stream consisting of the results of applying the given
function to the elements of this stream.
|
<U> Stream<U> |
DoubleStream.mapToObj(DoubleFunction<? extends U> mapper)
Returns an object-valued
Stream consisting of the results of
applying the given function to the elements of this stream. |
<U> Stream<U> |
IntStream.mapToObj(IntFunction<? extends U> mapper)
Returns an object-valued
Stream consisting of the results of
applying the given function to the elements of this stream. |
<U> Stream<U> |
LongStream.mapToObj(LongFunction<? extends U> mapper)
Returns an object-valued
Stream consisting of the results of
applying the given function to the elements of this stream. |
static <T> Stream<T> |
RefStreams.of(T... values)
Returns a sequential ordered
Stream whose elements are the
specified values. |
static <T> Stream<T> |
RefStreams.of(T t)
Returns a sequential
Stream containing a single element. |
static <T> Stream<T> |
RefStreams.ofNullable(T t)
Returns a sequential
Stream containing a single element, if
non-null, otherwise returns an empty Stream . |
static <T> Stream<T> |
StreamSupport.parallelStream(Collection<? extends T> c)
Creates a new possibly parallel
Stream using either the given
collection's Collection.iterator() as the source of
elements for an internally created Spliterator which will report
the collection's Collection.size() as its initial size
or a specialized Spliterator implementation (effectively the same
one that Java 8 uses) if the passed Collection is one of the
types listed below. |
Stream<T> |
Stream.peek(Consumer<? super T> action)
Returns a stream consisting of the elements of this stream, additionally
performing the provided action on each element as elements are consumed
from the resulting stream.
|
Stream<T> |
Stream.skip(long n)
Returns a stream consisting of the remaining elements of this stream
after discarding the first
n elements of the stream. |
Stream<T> |
Stream.sorted()
Returns a stream consisting of the elements of this stream, sorted
according to natural order.
|
Stream<T> |
Stream.sorted(Comparator<? super T> comparator)
Returns a stream consisting of the elements of this stream, sorted
according to the provided
Comparator . |
static <T> Stream<T> |
StreamSupport.stream(Collection<? extends T> c)
Creates a new sequential
Stream using either the given
collection's Collection.iterator() as the source of
elements for an internally created Spliterator which will report
the collection's Collection.size() as its initial size
or a specialized Spliterator implementation (effectively the same
one that Java 8 uses) if the passed Collection is one of the
types listed below. |
static <T> Stream<T> |
StreamSupport.stream(Collection<? extends T> c,
int characteristics)
Creates a new sequential
Stream using the given collection's
Collection.iterator() as the source of elements for an
internally created Spliterator which will report the collection's
Collection.size() as its initial size. |
static <T> Stream<T> |
StreamSupport.stream(Collection<? extends T> c,
int characteristics,
boolean parallel)
Creates a new sequential or parallel
Stream using the given
collection's Collection.iterator() as the source of
elements for an internally created Spliterator which will report
the collection's Collection.size() as its initial size. |
static <T> Stream<T> |
StreamSupport.stream(Spliterator<T> spliterator,
boolean parallel)
Creates a new sequential or parallel
Stream from a
Spliterator . |
static <T> Stream<T> |
StreamSupport.stream(Supplier<? extends Spliterator<T>> supplier,
int characteristics,
boolean parallel)
Creates a new sequential or parallel
Stream from a
Supplier of Spliterator . |
Stream<T> |
Stream.takeWhile(Predicate<? super T> predicate)
Returns, if this stream is ordered, a stream consisting of the longest
prefix of elements taken from this stream that match the given predicate.
|
static <T> Stream<T> |
RefStreams.takeWhile(Stream<? extends T> stream,
Predicate<? super T> predicate)
Returns, if the passed stream is ordered, a stream consisting of the longest
prefix of elements taken from the passed stream that match the given predicate.
|
Modifier and Type | Method and Description |
---|---|
static <T> Stream<T> |
RefStreams.concat(Stream<? extends T> a,
Stream<? extends T> b)
Creates a lazily concatenated
Stream whose elements are all the
elements of the first stream followed by all the elements of the
second stream. |
static <T> Stream<T> |
RefStreams.concat(Stream<? extends T> a,
Stream<? extends T> b)
Creates a lazily concatenated
Stream whose elements are all the
elements of the first stream followed by all the elements of the
second stream. |
static <T> Stream<T> |
RefStreams.dropWhile(Stream<? extends T> stream,
Predicate<? super T> predicate)
Returns, if the passed stream is ordered, a stream consisting of the remaining
elements of the passed stream after dropping the longest prefix of elements
that match the given predicate.
|
static <T> Stream<T> |
RefStreams.takeWhile(Stream<? extends T> stream,
Predicate<? super T> predicate)
Returns, if the passed stream is ordered, a stream consisting of the longest
prefix of elements taken from the passed stream that match the given predicate.
|
Modifier and Type | Method and Description |
---|---|
<R> Stream<R> |
Stream.flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
|
static <T,U,A,R> Collector<T,?,R> |
Collectors.flatMapping(Function<? super T,? extends Stream<? extends U>> mapper,
Collector<? super U,A,R> downstream)
Adapts a
Collector accepting elements of type U to one
accepting elements of type T by applying a flat mapping function
to each input element before accumulation. |
Copyright © 2016. All rights reserved.