The Good, the Bad and the Ugly of Java API Design
summary
Live coding with JShell demonstrates concrete API replacements added in Java 9–11: concise immutable factories (List.of / Set.of / Map.of and copyOf plus collectors), lazy stack access with StackWalker.walk (can retain class references and limit frames), process management via ProcessHandle (PID, info, pipelines and onExit returning CompletableFuture), and the HTTP/2 client (HttpClient/HttpRequest/HttpResponse with sendAsync). Examples run locally — server and client exchange a response, pipelines and onExit callbacks print PIDs as shown.
AI-written summary · about
chapters (29)
- 0:00Start
- 1:37Collections Api
- 4:02Java 9 Introduces New Factory Methods
- 6:11Instance Initializer Construct
- 7:31External Library
- 8:22Copy Constructor
- 11:01Copy Problem
- 11:44Collectors to Immutable Collections
- 15:35Practice To Create Immutable Objects by Default
- 17:25Stack Walker Api
- 20:11Avoid Hidden Behavior
- 20:21Patterns
- 20:35Choose the Right Data Structures and Object Representations
- 22:06The Process Api
- 23:06Problem with the Process Builder Api
- 25:43Process Handle
- 26:57Triggering Actions on Process Termination
- 27:08Process Builder
- 30:15Process Handle Interface
- 30:43Antipatterns
- 33:43New Http 2 Client from Java 11
- 36:48The Http Url Connection
- 37:38Runtime Cast
- 38:01Check the Status Code
- 39:31Apache Http Client
- 43:34Recap
- 44:30Inconsistent Capitalization
- 47:04Mandatory Blocking I / O
- 48:43Patterns That Are Nice in the New Api
related talks
49mThe Good, the Bad and the Ugly of Java API design
47mPolishing the Diamond: Core Library Improvements in Java 9
54mEffective JavaSE9 to 15APIs/Lang features, makes your life easier.
02h 34mExploring Java 9: The Key Parts
59mEffective Java SE 12 APIs/Lang features, makes your life easier
41mJava9 and REPL. Forget debugging, welcome joy and productivity
46mPolishing the Diamond: Core Library Improvements in Java 9
43mKeeping Up With Java
