effective-java-3e-source-code icon indicating copy to clipboard operation
effective-java-3e-source-code copied to clipboard

Update RecursiveTypeBound.java

Open blirp opened this issue 5 years ago • 0 comments

The original code would cause an NPE if any of the elements in the Collection c is null. This might be the intention, but makes line 14 weird, since an NPE would be thrown on line 13. My suggested modification throws an NPE only when all elements are null. This would be more in line with returning an Optional<E> as suggested in the text.

blirp avatar Sep 08 '19 12:09 blirp