Overview
Explore the history, rationale, and proper usage of Java's Optional class in this comprehensive 59-minute conference talk from Devoxx. Delve into the controversial and often misunderstood API, learning about its intended purpose, common antipatterns, and effective implementation strategies. Discover how to refactor code using Optional, understand its range of use cases, and master methods like map, filter, and ifPresent. Examine the problems with Optional.get() and other potential issues, while gaining insights into proposed improvements for Java 9. Benefit from the expertise of Stuart Marks, a Principal Member of Technical Staff in Oracle's Java Platform Group, as he shares valuable recommendations for leveraging this powerful feature in your Java programming.
Syllabus
Introduction
Overview
Optional
Why Optional
Refactoring
What is Optional
Using Optional
Range of Use Cases
Optional Exceptions
Optional Methods
Optional Map
Optional Filter
IfPresent
Other Methods
Stream Methods
Optional of Nullable
Avoiding Ordinary If Statements
Writing the Code
Problem with Optional
Optional Get
Other Issues
Overuse of Optional
Bike Shading
Fields
Blogs
Wrapup
Taught by
Devoxx