4 ms·
Stream already has a max method: return listOfTxnAmounts.stream().max(BigDecimal::compareTo).orElse(BigDecimal.ZERO); (They behave differently for a list
by ajanuary 12y ago
Stream already has a max method:
return listOfTxnAmounts.stream().max(BigDecimal::compareTo).orElse(BigDecimal.ZERO);
(They behave differently for a list that only has negative numbers, but it seems like that isn't a part of the domain anyway)