public final class DoubleStreams
extends java.lang.Object
DoubleStream
interface.Modifier and Type | Class and Description |
---|---|
static class |
DoubleStreams.J8Builder
A place for static default implementations of the new Java 8
default interface methods and static interface methods in the
DoubleStream.Builder interface. |
Modifier and Type | Method and Description |
---|---|
static DoubleStream.Builder |
builder()
Returns a builder for a
DoubleStream . |
static DoubleStream |
concat(DoubleStream a,
DoubleStream 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 DoubleStream |
empty()
Returns an empty sequential
DoubleStream . |
static DoubleStream |
generate(DoubleSupplier s)
Returns an infinite sequential unordered stream where each element is
generated by the provided
DoubleSupplier . |
static DoubleStream |
iterate(double seed,
DoubleUnaryOperator f)
Returns an infinite sequential ordered
DoubleStream 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. |
static DoubleStream |
of(double... values)
Returns a sequential ordered stream whose elements are the specified values.
|
static DoubleStream |
of(double t)
Returns a sequential
DoubleStream containing a single element. |
public static DoubleStream.Builder builder()
DoubleStream
.public static DoubleStream empty()
DoubleStream
.public static DoubleStream of(double t)
DoubleStream
containing a single element.t
- the single elementpublic static DoubleStream of(double... values)
values
- the elements of the new streampublic static DoubleStream iterate(double seed, DoubleUnaryOperator f)
DoubleStream
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.
The first element (position 0
) in the DoubleStream
will be the provided seed
. For n > 0
, the element at
position n
, will be the result of applying the function f
to the element at position n - 1
.
seed
- the initial elementf
- a function to be applied to to the previous element to produce
a new elementDoubleStream
public static DoubleStream generate(DoubleSupplier s)
DoubleSupplier
. This is suitable for
generating constant streams, streams of random elements, etc.s
- the DoubleSupplier
for generated elementsDoubleStream
public static DoubleStream concat(DoubleStream a, DoubleStream b)
Implementation Note:
Use caution when constructing streams from repeated concatenation.
Accessing an element of a deeply concatenated stream can result in deep
call chains, or even StackOverflowException
.
a
- the first streamb
- the second stream