- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 allMatch() method in Java
The allMatch() method in the DoubleStream class returns whether all elements of this stream match the provided predicate.
The syntax is as follows −
boolean allMatch(DoublePredicate predicate)
Here, the argument predicate is a stateless predicate to apply to elements of this stream. The DoublePredicate is a predicate of one double-valued argument.
To use the DoubleStream class in Java, import the following package −
import java.util.stream.DoubleStream;
Create DoubleStream and add some elements −
DoubleStream doubleStream = DoubleStream.of(15.8, 28.7, 35.7, 48.1, 78.9);
Now, check whether the condition is TRUE for elements of the stream −
boolean res = doubleStream.allMatch(num -> num > 10);
The following is an example to implement DoubleStream allMatch() 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(15.8, 28.7, 35.7, 48.1, 78.9); boolean res = doubleStream.allMatch(num -> num > 10); System.out.println("Do all the elements match the predicate? "+res); } }
Output
Do all the elements match the predicate? True
- Related Articles
- IntStream allMatch() method in Java
- DoubleStream min() method in Java
- DoubleStream count() method in Java
- 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 forEachOrdered() method in Java
- DoubleStream skip() method in Java
- DoubleStream concat() method in Java

Advertisements