List of usage examples for java.util.stream Collectors summarizingInt
public static <T> Collector<T, ?, IntSummaryStatistics> summarizingInt(ToIntFunction<? super T> mapper)
From source file:Main.java
public static void main(String[] args) { IntSummaryStatistics incomeStats = Employee.persons().stream() .collect(Collectors.summarizingInt(Employee::getIncome)); System.out.println(incomeStats); }
From source file:Main.java
public static void main(String[] args) throws Exception { List<Person> persons = Arrays.asList(new Person("Max", 18), new Person("Peter", 23), new Person("Pamela", 23), new Person("David", 12)); IntSummaryStatistics ageSummary = persons.stream().collect(Collectors.summarizingInt(p -> p.age)); System.out.println(ageSummary); }