Java

Refactoring to Java 8

Tuesday, November 29, 2016

Devoxx Refactoring to Java 8 (by Trisha Gee)

A talk about refactoring to Java 8 and the impact on performance.

 

Why should you refactor to Java 8:

  • It’s generally faster
  • Easy to parallelize
  • Fewer lines of code (more readable)
  • Minimizes errors
  • Learn the new features of Java 8

The talk shows numerous refactoring examples with performance charts comparing before and after the refactoring:

  • Lambda expressions
  • Lazy evaluation
  • Collections & Streams
    • forEach
    • collect
    • parallel
    • collapsing multiple operations
    • anyMatch
    • findFirst
    • removeIf

 

Conclusion

If performance is important (which most of the time it does), do performance tests to see the impact of the refactoring as some of the new Java 8 API features aren’t necessary faster!
Your tools (e.g. IntelliJ) can help you to do the refactoring for you.

You can view the entire talk at https://www.youtube.com/watch?v=NcetKbGayZY

 

/JV