Advertisement

Use in Optionals

  • Ralph Lecessi
Chapter

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.

Copyright information

© Ralph Lecessi 2019

Authors and Affiliations

  • Ralph Lecessi
    • 1
  1. 1.Kendall ParkUSA

Personalised recommendations