Abstract
It is useful to wrap an object inside an Optional to avoid checking for nullness. Optionals can also be used inside method chains to simplify the logic of a program. The Optional class wraps an object of type parameter T. The Optional class provides methods that can be used to create chains of Optionals. An Optional chain can be used to track consumption of a resource.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2019 Ralph Lecessi
About this chapter
Cite this chapter
Lecessi, R. (2019). Use in Optionals. In: Functional Interfaces in Java. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-4278-0_11
Download citation
DOI: https://doi.org/10.1007/978-1-4842-4278-0_11
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-4277-3
Online ISBN: 978-1-4842-4278-0
eBook Packages: Professional and Applied ComputingApress Access BooksProfessional and Applied Computing (R0)