Created
August 8, 2017 19:43
-
-
Save damgel/dcee6d7671e28b4953c8de957bc2ba7a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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