Skip to content

Commit

Permalink
quero map<Product, BigDecimal>
Browse files Browse the repository at this point in the history
  • Loading branch information
Turini committed Mar 13, 2014
1 parent e885903 commit e396dc2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/br/com/casadocodigo/java8/Capitulo11.java
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@ public static void main (String... args) throws Exception {
// que tipo de produto é o mais vendido (sum(VIDEO), sum(AUDIO))

// quero map<Product, BigDecimal>

payments.stream()
.map(Payment::getProducts)
.flatMap(p -> p.stream())
.collect(Collectors.groupingBy(Function.identity(),
Collectors.reducing(BigDecimal.ZERO, Product::getPrice, BigDecimal::add)));


// quero map<MonthYear, Map<Product, BigDecimal>>

// quero map<Customer, List<Payment>>, list ordenado por horario da compra
Expand Down

0 comments on commit e396dc2

Please sign in to comment.