Migrating onto Java 8

Java 8 Course · lesson 15 of 16 · 4 min read

What to change first, what breaks, and what to leave alone.

Open this lesson in the learning hub

Key points

  • Do it in order: compile on 8 first, adopt java.time next, then lambdas, then streams.
  • Rewriting every loop into a stream is the classic mistake - a plain loop with a break is often clearer.
  • Watch for overload ambiguity: adding a lambda-friendly overload can make existing calls ambiguous.
  • -XX:MaxPermSize flags must be removed from startup scripts; they are ignored and only add noise.
  • The biggest real win is usually java.time - it deletes an entire class of thread-safety bugs.

Migrate for correctness before style: java.time removes real bugs, stream rewrites mostly move code around.

This is a reading copy. The full lesson — with the visual explainer, the interactive lab and a Run button for the code — lives in the Java 8 Course course, and every lesson in it is listed on the Java 8 Course contents page.