4 ms·
I've done this in Java for almost ten years now articles.findAll{ it.tags.contains("Java") } All I've done is adding groovy.jar
by olavgg 12y ago
I've done this in Java for almost ten years now
articles.findAll{ it.tags.contains("Java") }
All I've done is adding groovy.jar
- vorg 12y agoYour example code is not valid Java syntax so you haven't been able to do it in Java for almost 10 years. Your example is written in Groovy, one of many alternative languages for the JVM, along with Scala, JRuby, Clojure, Beanshell (which Groovy was "inspired" by), Jython (which has been around for 18 years now, and originally called "JPython"), Gosu, and more recently Kotlin and Ceylon. Java didn't have such anonymous functions (called "lambdas" in Java, and "closures" in Groovy) until Java 8.