[JAVA] Item 69: Use exceptions only for exceptional conditions

69. Exceptions should be used only in exceptional circumstances


// Do not use this hideous code for iteration over a collection!

try {

    Iterator<Foo> i = collection.iterator();

    while(true) {

        Foo foo = i.next();

        ...

    }

} catch (NoSuchElementException e) {

Recommended Posts

Item 69: Use exceptions only for exceptional conditions
Item 70: Use checked exceptions for recoverable conditions and runtime exceptions for programming errors
Use only for writing files --Apache Camel
Item 71: Avoid unnecessary use of checked exceptions
Item 72: Favor the use of standard exceptions
Use Maven only for downloading dependent libraries
Support for CheckStyle "Do not use inline conditions"
Item 52: Use overloading judiciously
Item 53: Use varargs judiciously
Item 45: Use streams judiciously