The code below doesn't compile. I get Unhandled exception type Throwable
.
public static void main(final String[] args) throws Exception {
MyResponse myResponse = new MyResponse();
myResponse.getObjects().stream().findFirst().orElseThrow(() -> SOME_EXCEPTION);
}
However if I put the type object then it works fine :
MyResponse<Object> myResponse = new MyResponse<>();
And MyResponse
class has a list of objects :
private List<T> objects;
What could be the issue?