Java Collections

NFJS 2005: Java Collections Power Techniques

Glen Vanderburg gave an exhaustive presentation on the Java Collections Framework. Despite the mundane subject matter, this was a session worth attending. Although most of the tips and tricks were old hat to experienced developers, I’m certain everyone learned something new.

My favorite tidbits:

  • Collections.binarySearch(…)

  • Glenn’s ugly trick of using try…finally to execute code after a return

  • Glenn’s DemandMap, a Map decorator that uses a provided Factory to create missing values

  • Overriding removeEldestEntry(…) to expire items in an LRU cache.

Glenn also highly recommended Effective Java.

I posted this in March 2005 during week 1619.

For more, you should follow me on the fediverse: @hans@gerwitz.com