Google collections is definitely the way to go on this one. That library just plain rocks... :)
On Fri, Nov 13, 2009 at 4:59 PM, Andreas Petersson <[email protected]> wrote: > > With Google-Collections in your classpath this is easy: > > if your Foo Objects elements implement Comparable: > > Ordering.natural().max(one,two); //varargs works for any number! > > or alternatively: > > or for Iterable<Foo> : > Ordering.natural().max(fooIterable) > > or if not, given an explicit Comparator: > > Ordering.from(someComparator).max(one,two); > > i do really recommend using G-C for nearly all things Collections, > Comparing, and Preconditions of arguments. > > http://code.google.com/p/google-collections/ > > http://google-collections.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Ordering.html > > >> It seems to me there should be a method somewhere to determine the >> maximum of two Comparables. > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
