I know how to deal with exceptions in functional interfaces, but i have to move exception outside my lambda. (main should throw IOExc)
public static void main(String[] args) throws IOException {
Function<String,List<String>> flines = f->{
//reading from input stream, but i cant use try catch
}
}
My new interface has to inherit from java.util.function. Any ideas how to do it? Smth like this doesnt work well
public interface MyFunction<T,R> extends Function<T,R> {
@Override
default R apply(T t) {
try {
return applyThrows(t);
}catch (Exception e){
throw new RuntimeException(e);
}
}
R applyThrows (T t) throws IOException;