java.util.function library

Posted on Leave a commentPosted in Architect, Java

As in previous topic, we can use functional interfaces to use in lambda expression see topic on: Java 8 interfaces However Java 8 goes on more to provide us mechanism to easier create lambda expressions. See java.util.function library. No need to create an functional interface and just overwrite existing ones in this library. This library […]

Java 8 Interfaces

Posted on Leave a commentPosted in Architect, Java

There are several changes for interfaces, including the addition of static and default methods. Interfaces in java 8 is more and more similar to abstract method.  Consider the example below: Key notes: static static methods inside interfaces are only accessible inside the interface. No way to access from outside the interface, see initializeTestData() method above. default default […]

Java 8 Lambda Function

Posted on Leave a commentPosted in Java

Lambda functions – enables you to treat functionality as method arguments. The forEach() method for handling a collection of data. In this case, we have a list of Person, instead of doing a for loop we are using lambda syntax: For more complex methods you can wrap it in brackets, acting as anonymous classes. Lambda expressions can […]