Skip to content

Instantly share code, notes, and snippets.

@hpcx82
Created October 31, 2011 07:43
Show Gist options
  • Save hpcx82/1327086 to your computer and use it in GitHub Desktop.
Save hpcx82/1327086 to your computer and use it in GitHub Desktop.
template <typename T>
T max(const T& a, const T& b)
{
return a > b ? a : b;
}
public static T max<T >(T a, T b) where T: System.IComparable<T>
{
return a.CompareTo(b) > 0 ? a : b;
}
static <T extends Comparable<T> > T max(final T a, final T b)
{
return a.compareTo(b) > 0 ? a : b;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment