If you use Java 8, you can use the Java Stream class, which is a bit like Underscore, which is designed for functional programming. Here are some of the methods available , including map, cut, filter, min, max, etc.
For example, if the following code was underlined:
var words = ["Gallinule", "Escambio", "Aciform", "Entortilation", "Extensibility"];
var sum = _(words)
.filter(function(w){return w[0] == "E"})
.map(function(w){return w.length})
.reduce(function(acc, curr){return acc + curr});
alert("Sum of letters in words starting with E... " + sum);
You can write it in Java 8 as follows:
String[] words = {"Gallinule", "Escambio", "Aciform", "Entortilation", "Extensibility"};
int sum = Arrays.stream(words)
.filter(w -> w.startsWith("E"))
.mapToInt(w -> w.length())
.sum();
System.out.println("Sum of letters in words starting with E... " + sum);