Algorithms
Algorithms copied to clipboard
Changing Exception Types Being Thrown
trafficstars
This PR changes the types of exceptions being thrown by the methods. More specifically, this PR:
- Replaces uses of
java.lang.Exception(way too broad) with more appropriate subclasses of it - Replaces uses of
java.lang.RuntimeExceptionwith more appropriate subclasses of it - Replaces uses of
java.lang.IllegalArgumentExceptionfor invalidnullarguments withjava.lang.NullPointerException(mostly viajava.util.Objects.requireNonNull(Object))Applications should throw instances of this class to indicate other illegal uses of the
nullobject. Java 11 API:java.lang.NullPointerException - Replaces uses of
java.lang.IllegalArgumentExceptionfor invalid index withjava.lang.IndexOutOfBoundsException - Etc.