import java.util.*; class Algorithm { public boolean isEmptyArray(int[] Arr ){ if ( Arr == null || Arr.length == 0) { … More
Tag: streams
Java 8 : How to use findFirst() in Streams API?
You can use this to do any interaction and break the process when find the first conditional. Example Optional<Plate> myFirstVegetarianOptional … More
Java 8 : How to sum Integer values with streams ?
Below follows an example that show how to get the sum total of all attributes contained in a collection. Example … More
Java 8 : How to sort a collection with Streams?
For do this you can use : .stream().sorted(new Comparator<MyObject>() { @Override public int compare(MyObject o1, MyObject o2) { return o1.getId().compareTo(o2.getId()); … More
Java 8 : How to stop a foreach process when you are using Streams ?
For do this you can use : anyMatch(conditional) The anyMatch will make the interaction until take a conditional return equals … More