Utility code based on Google Guava