

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
DoubleStream iterator() method in Java
The iterator() method of the DoubleStream class in Java returns an iterator for the elements of this stream.
The syntax is as follows
PrimitiveIterator.OfDouble iterator()
Here, PrimitiveIterator.OfDouble is an Iterator specialized for double values.
To use the DoubleStream class in Java, import the following package
import java.util.stream.DoubleStream;
The following is an example to implement DoubleStream iterator() method in Java
Example
import java.util.*; import java.util.stream.DoubleStream; public class Demo { public static void main(String[] args) { DoubleStream doubleStream = DoubleStream.of(50.6, 69.8, 81.8, 95.6, 106.9); PrimitiveIterator.OfDouble res = doubleStream.iterator(); while (res.hasNext()) { System.out.println(res.nextDouble()); } } }
Output
50.6 69.8 81.8 95.6 106.9
- Related Questions & Answers
- DoubleStream distinct() method in Java
- DoubleStream filter() method in Java
- DoubleStream of() method in Java
- DoubleStream parallel() method in Java
- DoubleStream sum() method in Java
- DoubleStream noneMatch() method in Java
- DoubleStream boxed() method in Java
- DoubleStream mapToLong() method in Java
- DoubleStream findAny() method in Java
- DoubleStream mapToInt() method in Java
- DoubleStream limit() method in Java
- DoubleStream findFirst() method in Java
- DoubleStream flatMap() method in Java
- DoubleStream sorted() method in Java
- DoubleStream anyMatch() method in Java
Advertisements