// don't care
value = map.get(key);
do bleh
// care
if (map.containsKey(key)) {
do blah
} else {
value = map.get(key);
do bleh
}
To be clear, there are two kinds of errors:1. The code is screwed up. Java runtime exception, log and hope someone is paying attention to the logs.
2. The world is screwed up. Java checked exception, catch and return a nice message to the user.