Transaction { public int getValue() { return value; } 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();  }
@Test public void test7(){ Optional<Integer> max = transactions.stream() .map((t) -> t.getValue()) .max(Integer::compare); System.out.println(max.get()); }
@Test public void test8(){ Optional<Transaction> op = transactions.stream() .min((t1, t2) -> Integer.compare(t1.getValue(), t2.getValue())); System.out.println(op.get()); }