@Test public void test6(){ Integer cambridge = transactions.stream() .filter((t) -> t.getTrader().getCity().equals("Cambridge")) .map(Transaction::getValue) .reduce(0, Integer::sum); System.out.println(cambridge); }
public Trader getTrader() { return trader; }
Transaction { public Trader getTrader() { return trader; } }
Transaction { public Trader getTrader() { return trader; } Transaction();  Transaction(Trader trader, int year, int value); }
Transaction { public Trader getTrader() { return trader; } Transaction();  Transaction(Trader trader, int year, int value); Trader getTrader(); void setTrader(Trader trader); int getYear(); void setYear(int year); int getValue(); void setValue(int value); @Override String toString(); }
Transaction { public Trader getTrader() { return trader; } Transaction();  Transaction(Trader trader, int year, int value); Trader getTrader(); void setTrader(Trader trader); int getYear(); void setYear(int year); int getValue(); void setValue(int value); @Override String toString();  }