5 ms·
Just use Optional<T>! This is what it's for! There's some saying about Java "design patterns" that can just be replaced with closures. There should probably be
by cballard 11y ago
Just use Optional<T>! This is what it's for!
There's some saying about Java "design patterns" that can just be replaced with closures. There should probably be another for for ADTs.
- arcticbull 11y agoAgreed completely. The null object with inheritance is particularly difficult to deal with because you're just asking to forget to nerf something dangerous in the superclass leaving you with partially functional objects. Optional<T> is the right way to handle this.