Learn how to replace verbose Java 7 anonymous class callbacks with clean lambda expressions in an existing project.
Understand how Java 8 Streams work by reading short examples for filtering, mapping, sorting, and reducing collections.
Pick up the new Java 8 Date API to replace old Calendar and Date code in a legacy codebase.
This repository is a hands-on tutorial that walks through the new features added to Java in version 8. Java 8 was a big release because it brought ideas from functional programming into what had been a strictly object-oriented language. The README explicitly avoids long explanations and is structured as a series of short topics followed by small, commented code snippets so you can see each feature in action. The guide covers several language additions one by one. Default methods let you add real implementations directly to an interface using the default keyword, so older interfaces can grow without breaking the classes that already implement them. Lambda expressions are a much shorter way to write small one-method objects, especially the comparators and callbacks that used to require verbose anonymous classes. Functional interfaces and the @FunctionalInterface annotation are the type glue that makes lambdas work. Method and constructor references with the :: operator give you a shorthand for passing existing methods around as values. The tutorial also covers the new library APIs in Java 8. Streams let you filter, sort, map, count, match and reduce collections in a pipeline style, with a parallel variant that uses several CPU cores at once. The Optional type expresses values that might be missing. The new Date API replaces the old date classes with cleaner pieces like Clock, LocalTime, LocalDate, LocalDateTime and timezone handling. There are also short sections on the built-in functional interfaces, on map extensions, and on repeatable annotations. The author notes a follow-up tutorial covering Java 9, 10 and 11. The full README is longer than what was provided.
← winterbe on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.