Examples of generic utility functions, based on questions at
http://docs.oracle.com/javase/tutorial/java/generics/QandE/generics-questions.html