JDK 7 - Try with Resources

JDK 7 has several enhancements to the try-catch construct. Try with resources allows for ensuring that resources are closed and freed up without the need to explicitly call the close function. Any class implementing java.lang.AutoCloseable can be automatically closed without the need for a finally section in the try block.

The syntax is a [...]

JDK 7 - use Strings in switch statements

JDK 7 adds the ability to use String objects as the case in switch blocks. It’s not exactly an earth shattering addition but I find it quite useful in avoiding long if-then chains. Plus the release docs claim that using a switch is more efficient.

At the bottom of this post is a small [...]