Java Optional 和 null - 概念、设计和实践
Java Optional and null - Concepts, Design and Practice
- 1. Introduction to null and Optional
- 1. Welcome
- 2. Introduction
- 3. Null Concepts
- 4. Null Technicalities
- 5. Null Defaults
- 6. Null Storage
- 7. Null Design Considerations
- 8. Why Optional
- 2. Life Before Optional
- 1. Preventing Null Before Optional
- 2. What Other Languages Do
- 3. What is Java Optional
- 1. What is Optional
- 2. Optional Basics
- 3. When to Use It
- 4. When Not to Use It
- 5. Overuse of Optional
- 4. Optional Methods in Detail
- 1. IsPresent() and get()
- 2. ifPresent()
- 3. ifPresentOrElse()
- 4. isPresent() and isEmpty()
- 5. All the ORs
- 6. map()
- 7. flatMap()
- 8. filter()
- 9. Equality
- 10. Similarity to Streams
- 11. Streams
- 12. Specialized Optionals
- 5. Alternatives to Optional
- 1. Null Annotations
- 2. One Annotation That Is Different
- 3. Checker Frameworks
- 4. Null Object Pattern
- 5. Java 14 Helpful NPEs
- 6. Null Functions
- 7. Is Optional a Monad
- 8. Guavas Alternative to Optional
- 9. VAVRs Alternative to Optional
- 10. Palatable Lambda Alternative to Optional
- 11. Scala Alternative to Optional
- 12. Haskell Alternative to Optional
- 13. Kotlin Alternative to Optional
- 14. Dart Sound Null Safety