3 ms·
Ideally we want something like class Stream<T> { <R, X> Stream<R> map( Function<? super T, ? extends R, throws X> mapper ) throws X } and if
by erik_seaberg 7y ago
Ideally we want something like
class Stream<T> {
<R, X> Stream<R> map(
Function<? super T, ? extends R, throws X> mapper
) throws X
}
and if you pass a function that throws, say, IOException and SQLException, then X=IOException|SQLException and that's what that call to #map throws.
You can sort of do it by http://natpryce.com/articles/000738.html http://natpryce.com/articles/000738.html but you have to choose one base type and you can't make stdlib support it.