just so you know, both Apache Commons and Guava provide helpers to make this easy