API Design with Java 8 Lambdas and Streams
summary
Practical, example-driven rundown of how Java 8 actually reshapes APIs: shows adding ThreadLocal.withInitial instead of subclassing, the new Map.computeIfAbsent helper, and a small set of comparator factories and combinators (Comparator.comparing, thenComparing, nullsFirst/reversed) that avoid a combinatorial explosion. Covers Streams implementation details (Spliterator, StreamSupport, primitive streams) and when to return a Stream vs a Collection, plus concrete guidance on Optional (use only for method returns, not fields/params) and sensible uses of default methods.
AI-written summary · about
chapters (25)
- 0:00Introduction
- 2:13Questions
- 2:56Designing API with Lambda Expressions
- 6:50How ThreadLocal works
- 8:16Multimap example
- 11:07Benefits of map
- 12:05Sort Methods
- 14:04Comparators
- 17:13Nulls
- 24:12Twitter Questions
- 26:51Streams API
- 29:08Collections vs Streams
- 32:33Return a Stream
- 33:59Convert Iterator to Stream
- 38:55Primitives
- 39:53Recap
- 45:25Optional
- 46:31Summary
- 48:54Optional Methods
- 51:17Optional Examples
- 51:55Where to Use Optional
- 55:21Code Smells
- 55:54Default Methods
- 57:44Default Method Example
- 58:13Other Use Cases
related talks
01h 07mJava SE: Lambdas, Streams & Future Directions
55mTransforming Your Code to Java 8
01h 25mJava 8 Language Capabilities, What's in it for you?
49mJava 8: the good, the bad and the ugly
49mJava Streams: Beyond The Basics
47mBeyond lambdas, the aftermath
50m10+ new features you ought to know using Java 8
49mThe Good, the Bad and the Ugly of Java API design
