
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
IntStream Builder Method in Java
The builder() method in IntStream class is used to return a builder for an IntStream.
The syntax is as follows:
static IntStream.Builder builder()
Here, we have created an IntStream and used the builder() method. An element is added using add() method:
IntStream intStream = IntStream.builder().add(25).build();
The following is an example to implement IntStream builder() method in Java −
Example
import java.util.*; import java.util.stream.Stream; import java.util.stream.IntStream; public class Demo { public static void main(String[] args) { IntStream intStream = IntStream.builder().add(25).build(); intStream.forEach(System.out::println); } }
output
25
Advertisements