Here's a helpful method for returning the maximum of two Comparable objects. Do the Java APIs provide this somewhere?
/**
 * Return the <i>maximum</i> of the two arguments. If the arguments 
 * are <i>equal</i> (as defined by the Comparable contract), the
 * <i>left-hand-side</i> argument is returned.
 */
public static <T extends Comparable> T max(T lhs, T rhs)
{
    return rhs.compareTo(lhs) > 0 ? rhs : lhs;
}
Share and Enjoy:
  • Facebook
  • Twitter
  • StumbleUpon
  • Digg
  • del.icio.us
  • Reddit
  • Technorati
  • Google Bookmarks
  • Slashdot
  • N4G