Xtend Functional processing http://aruld.info/why-java-8-will-be-a-top-contender-for-java-next-languages/
def static void main(String[] args) { | |
val employees = Arrays.asList("neal", "s", "stu", "j", "rich", "bob") | |
val result = employees.stream | |
.filter[length() > 1] | |
.map[toFirstUpper()] | |
.reduce[x, y | x + "," + y] | |
} | |
// without map() | |
def static void main(String[] args) { | |
val employees = Arrays.asList("neal", "s", "stu", "j", "rich", "bob") | |
val result = employees.stream | |
.filter[length() > 1] | |
.reduce[x, y | x.toFirstUpper + "," + y.toFirstUpper] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment