Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Related Rants
java.util.Optional.or, orElse and orElseGet should really have their signatures changed so they can widen the type. For example, `Optional<T> or(Supplier<? extends Optional<? extends T>> supplier)` should really be `<U, S super T & U> Optional<S> or(Supplier<? extends Optional<? extends U>> supplier)`
Then we could eliminate the following unchecked cast:
```
public static double getOrNan(Optional<? extends Number> optionalNumber) {
return ((Optional<Number>)optional).getOrElse(Double.NaN).doubleValue();
}
```
rant
optional
java
generics