User Tools

Site Tools


programming:java:java8

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
programming:java:java8 [2023/10/31 13:42] – [Terminal Methods] skipidarprogramming:java:java8 [2023/11/01 07:31] (current) – ↷ Page moved from camunda:programming:java:java8 to programming:java:java8 skipidar
Line 378: Line 378:
 | reducing | The type produced by the reduction operation  | Reduce the stream to a single value starting from an initial value used as accumulator and iteratively combining it with each item of the stream using a BinaryOperator.  | <code> int totalCalories = menuStream.collect(reducing(0, Dish::getCalories, Integer::sum));  </code> | | reducing | The type produced by the reduction operation  | Reduce the stream to a single value starting from an initial value used as accumulator and iteratively combining it with each item of the stream using a BinaryOperator.  | <code> int totalCalories = menuStream.collect(reducing(0, Dish::getCalories, Integer::sum));  </code> |
 | collectingAndThen  | The type returned by the transforming function  |   | <code> int howManyDishes = menuStream.collect(collectingAndThen(toList(), List::size));   </code> | | collectingAndThen  | The type returned by the transforming function  |   | <code> int howManyDishes = menuStream.collect(collectingAndThen(toList(), List::size));   </code> |
-| groupingBy | Map<K, List<T>> | Maps the stream to groups (as hashmap keys)  | <code> Map<Dish.Type, List<Dish>> dishesByType = menuStream.collect(groupingBy(Dish::getType)); </code> |+| groupingBy | Map<K, List<T>> | Maps the stream to groups (as hashmap keys)  | <sxh java> Map<Dish.Type, List<Dish>> dishesByType = menuStream.collect(groupingBy(Dish::getType)); </sxh> |
 | partitioningBy | Map<Boolean, List<T>> |  | <code> Map<Boolean, List<Dish>> vegetarianDishes =menuStream.collect(partitioningBy(Dish::isVegetarian)); </code> | | partitioningBy | Map<Boolean, List<T>> |  | <code> Map<Boolean, List<Dish>> vegetarianDishes =menuStream.collect(partitioningBy(Dish::isVegetarian)); </code> |
  
programming/java/java8.1698759766.txt.gz · Last modified: by skipidar