IntStream summaryStatistics() example
Description
IntStream summaryStatistics()
returns an IntSummaryStatistics describing various summary data about the elements of this stream.
Syntax
summaryStatistics
has the following syntax.
IntSummaryStatistics summaryStatistics()
Example
The following example shows how to use summaryStatistics
.
import java.util.IntSummaryStatistics;
import java.util.stream.IntStream;
/*w ww. j av a 2 s . co m*/
public class Main {
public static void main(String[] args) {
IntStream i = IntStream.of(6,5,7,1, 2, 3, 3);
IntSummaryStatistics s = i.summaryStatistics();
System.out.println(s);
}
}
The code above generates the following result.