Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Optional<BigDecimal> max = Optional.empty();
if (!this.itemsFiltered.isEmpty()) {//check if list is not empty
max = itemsFiltered.stream()
.map(a -> a.getPrecioVentaNuevo())
.max(Comparator.naturalOrder());
if (max.isPresent()) {
Utilidades.Error("maxOptional:" + max);//prints optional value
Utilidades.Error("maxValue:" + max.get());//prints real value if any found.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.