Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
DoubleStream.Builder accept() method in Java
The accept() method of the DoubleStream class in Java adds an element to the stream being built.
The syntax is as follows −
void accept(double ele)
Here, ele is the element to be inserted into the stream.
To use the DoubleStream.Builder class in Java, import the following package −
import java.util.stream.DoubleStream;
The following is an example to implement DoubleStream.Builder() accept() method in Java −
Example
import java.util.stream.DoubleStream;
public class Demo {
public static void main(String[] args) {
DoubleStream.Builder builder = DoubleStream.builder();
builder.accept(12.9);
builder.accept(25.6);
builder.accept(35.8);
builder.accept(43.9);
builder.accept(56.3);
builder.accept(67.4);
builder.accept(78.8);
builder.accept(89.4);
builder.build().forEach(System.out::println);
}
}
Output
12.9 25.6 35.8 43.9 56.3 67.4 78.8 89.4
Advertisements
