I've got a project which is set up with Java 11. I have this piece of code :
Lineup lineup = (Lineup) c.list()
.stream()
.findFirst()
.orElseThrow(() -> new RuntimeException("not found"));
My IDE (Netbeans 19) refuses to compile this code. The error it gives is :
unreported exception Throwable : must be caught or declared to be thrown
I've been staring at this piece of code for some time now, trying different approaches, but no matter what I do it fails to compile. My understanding is that this should work, but I must clearly be doing something wrong.
What am I doing wrong?
