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?
There is already orElse(value) and orElseThrow(exception), so why not add a plain orElseThrow() to raise the default exception?
But the Java community should move towards ifPresent/map/filter/flatMap etc.