There is a class name, IntSummaryStatistics
For example:
List<Integer> primes = Arrays.asList(2, 3, 5, 7, 11, 13, 17, 19, 23, 29);
IntSummaryStatistics stats = primes.stream()
.mapToInt((x) -> x)
.summaryStatistics();
System.out.println(stats);
Output:
IntSummaryStatistics{count=10, sum=129, min=2, average=12.900000, max=29}
Hope it helps
Read about IntSummaryStatistics
Related Contents:
- Java 8 List into Map
- Why filter() after flatMap() is “not completely” lazy in Java streams?
- How can I throw CHECKED exceptions from inside Java 8 streams?
- How to force max to return ALL maximum values in a Java Stream?
- Java 8 lambdas, Function.identity() or t->t
- Copy a stream to avoid “stream has already been operated upon or closed”
- Java 8 Nested (Multi level) group by
- Using Java 8’s Optional with Stream::flatMap
- Java 8 Streams: multiple filters vs. complex condition
- Group by and sum objects like in SQL with Java lambdas?
- Retrieving a List from a java.util.stream.Stream in Java 8
- Filter Java Stream to 1 and only 1 element
- Java 8, Streams to find the duplicate elements
- How to apply multiple predicates to a java.util.Stream?
- Why doesn’t java.util.Collection implement the new Stream interface?
- How to use a Java8 lambda to sort a stream in reverse order?
- Does Java SE 8 have Pairs or Tuples?
- How can I throw CHECKED exceptions from inside Java 8 lambdas/streams?
- Why does Stream.allMatch() return true for an empty stream?
- Java 8 Collectors.toMap SortedMap
- Java 8 grouping using custom collector?
- Java 8 stream map to list of keys sorted by values
- Java 8 Lambda function that throws exception?
- In Java streams is peek really only for debugging?
- How to serialize a lambda?
- What is the equivalent lambda expression for System.out::println
- Java 8: Lambda-Streams, Filter by Method with Exception
- Java 8: Difference between method reference Bound Receiver and UnBound Receiver
- Java 8 Lambda Expressions – what about multiple methods in nested class
- Optional orElse Optional in Java
- Parallel streams, collectors and thread safety
- In Java, how do I efficiently and elegantly stream a tree node’s descendants?
- Can a Collector’s combiner function ever be used on sequential streams?
- Java 8: Mandatory checked exceptions handling in lambda expressions. Why mandatory, not optional?
- Why are Java 8 lambdas invoked using invokedynamic?
- Why do Consumers accept lambdas with statement bodies but not expression bodies?
- Simplest way to print an `IntStream` as a `String`
- Should Optional.ofNullable() be used for null check?
- Local variable log defined in an enclosing scope must be final or effectively final
- Why do I need a functional Interface to work with lambdas?
- Java 8 method references: provide a Supplier capable of supplying a parameterized result
- Java Lambda expressions [closed]
- Static context cannot access non-static in Collectors
- In Stream reduce method, must the identity always be 0 for sum and 1 for multiplication?
- Modifying Objects within stream in Java8 while iterating
- How to get a Stream from a float[]
- Comparator.comparing(…) of a nested field
- How to debug stream().map(…) with lambda expressions?
- How to compare two Streams in Java 8
- How to implement a Java stream?