Skip to content

Instantly share code, notes, and snippets.

@aruld
Last active January 1, 2016 14:29
Show Gist options
  • Save aruld/8158277 to your computer and use it in GitHub Desktop.
Save aruld/8158277 to your computer and use it in GitHub Desktop.
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