[JAVA] Item 71: Avoid unnecessary use of checked exceptions

71. Avoid the use of unnecessary checked exceptions


// Invocation with state-testing method and unchecked exception

if (obj.actionPermitted(args)) {

    obj.action(args);

} else {

    ... // Handle exceptional condition

}

Recommended Posts

Item 71: Avoid unnecessary use of checked exceptions
Item 72: Favor the use of standard exceptions
Item 70: Use checked exceptions for recoverable conditions and runtime exceptions for programming errors
[Read Effective Java] Chapter 2 Item 5 "Avoid the creation of unnecessary objects"
Item 69: Use exceptions only for exceptional conditions
Item 36: Use EnumSet instead of bit fields
Item 37: Use EnumMap instead of ordinal indexing
Use of Date class
Item 79: Avoid excessive synchronization
Item 52: Use overloading judiciously
Item 53: Use varargs judiciously
Item 45: Use streams judiciously