Java SE 8 Optional, a pragmatic approach
- Do not declare any instance variable of type Optional.
- Use null to indicate optional data within the private scope of a class.
- Use Optional for getters that access the optional field.
- Do not use Optional in setters or constructors.
- Use Optional as a return type for any other business logic methods that have an optional result.
No comments:
Post a Comment