Transforming Code to Java 8
summary
Step-by-step refactor examples show how lambdas plus java.util.stream (IntStream.range, Stream.iterate), Collectors.joining, Optional, Comparator.comparing/thenComparing and AutoCloseable/try‑with‑resources replace anonymous classes, loops and flags; an isPrime uses IntStream.range().noneMatch, first 100 primes use infinite lazy streams with filter map limit collect, findFirst returns Optional, and joining avoids comma logic. Code becomes more concise (claims 40–50% weight reduction), uses effectively final variables, and an implemented execute‑around method pattern encloses resource setup/cleanup and works as expected.
AI-written summary · about
chapters (11)
- 0:00Introduction to Java 8
- 1:13Imperative to functional style
- 5:48Refactoring thread pool code
- 15:19Prime number example
- 20:36Stream iteration and laziness
- 33:54Finding first available time slot
- 44:50File processing example
- 51:30Sorting with comparators
- 1:04:40Execute around method pattern
- 1:27:59Performance and testing
- 1:30:29Q&A and resources
related talks
55mTransforming Your Code to Java 8
43mRefactoring to Functional Style
56mJava Functional Programming Idioms
44mI didn't know you could do that with Java Streams!
49mJava Functional Programming Idioms
01h 01mAPI Design with Java 8 Lambdas and Streams
37mPragmatic Functional Refactoring with Java 8
49mJava Streams: Beyond The Basics
