3 ms·
The name getWhenPresent() doesn't seem descriptive to me. There is already orElse(value) and orElseThrow(exception), so why not add a plain orElseThrow() to ra
by willvarfar 11y ago
The name getWhenPresent() doesn't seem descriptive to me.
There is already orElse(value) and orElseThrow(exception), so why not add a plain orElseThrow() to raise the default exception?
- redcodenl 11y agoThe existing methods orElse(defaultValue) and orElseGet(supplier) and orElseThrow(exception) should be enough to cover everything get() does. But the Java community should move towards ifPresent/map/filter/flatMap etc.