First thing to remember summaryStatistics is only applicable for integer array/List not for strings.
This will provide summary information of integer list/array like min element,max element, sum ,count and avaerage.
int[] numbers = new int[]{2,1,3,5,6,7,8,9};
IntSummaryStatistics intSummaryStatistics = Arrays.stream(numbers) .summaryStatistics();System.out.println(intSummaryStatistics);
Output :
IntSummaryStatistics{count=8, sum=41, min=1, average=5.125000, max=9}
Tutorial :
Leave a Reply