Maybe you should have a look to 
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/ComparisonChain.html