LongStream asDoubleStream() example
Description
LongStream asDoubleStream()
returns a DoubleStream consisting of the elements of this stream, converted to double.
This is an intermediate operation.
Syntax
asDoubleStream
has the following syntax.
DoubleStream asDoubleStream()
Example
The following example shows how to use asDoubleStream
.
import java.util.stream.LongStream;
//w ww. j a v a2 s . c o m
public class Main {
public static void main(String[] args) {
LongStream b = LongStream.of(1L, 2L, Long.MAX_VALUE, Long.MIN_VALUE);
b.asDoubleStream().forEach(System.out::println);
}
}
The code above generates the following result.