@Test public void test3(){ transactions.stream() .filter((x) -> x.getTrader().getCity().equals("Cambridge")) .map(Transaction::getTrader) .sorted((e1,e2) -> e1.getName().compareTo(e1.getName())) .distinct() .forEach(System.out::println); }
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();  }