
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 summaryStatistics Method in Java
The summaryStatistics() method in the IntStream class is used to return summary data about the elements of this stream. The syntax is as follows:
IntSummaryStatistics summaryStatistics()
Create an IntStream and add some elements:
IntStream intStream = IntStream.of(30, 60, 90);
Now, get the summary data about the above elements:
IntSummaryStatistics details = intStream.summaryStatistics();
The following is an example to implement IntStream summaryStatistics() method in Java:
Example
import java.util.stream.IntStream; import java.util.IntSummaryStatistics; public class Demo { public static void main(String[] args) { IntStream intStream = IntStream.of(30, 60, 90); IntSummaryStatistics details = intStream.summaryStatistics(); System.out.println("Details = "+details); } }
Output
Details = IntSummaryStatistics{count=3, sum=180, min=30, average=60.000000, max=90}
Advertisements