Functional Programming in Java code