My company has been using the Java 8 JDK for quite some time now, however almost all of our developers are continuing to use the older java 6/7 coding techniques.
I am trying to motivate the R&D group to step out of their comfort zone and use the many goodies Java 8 provides, by creating a presentation of practical usage of the Java 8 features.
A classic example from my experience is using a lambda operation when instantiating an anonymous inner class:
// using an anonymous class
Runnable r = new Runnable() {
@Override
public void run() {
System.out.println("Hello");
}
};
// using a lambda expression
Runnable r2 = () -> System.out.println("Hello");
My planned presentation will not show 'Hello World' examples, but rather more common issues encountered during SW engineering which can be solved rather easily using the Java 8 features.
My questions is this : Can you provide an actual, practical example of using a Java 8 feature (code snippet included) which showcases the benefit of the feature using an actual, non trivial (ie - hello world) example?
A few words on what the actual benefits were (better performance, improved code readability, less boilerplate code, better implementation of design patterns, etc...) would be greatly appreciated
Aucun commentaire:
Enregistrer un commentaire