static <T extends Comparable<T>> Comparator<T> getComparator(boolean ascending, T dummy) {
    Comparator<T> comp;
    if (ascending) {
      comp = new Comparator<T>() {
        public int compare(T o1, T o2) {
          return o1.compareTo(o2);
        }
      };
    } else {
      comp = new Comparator<T>() {
        public int compare(T o1, T o2) {
          return o2.compareTo(o1);
        }
      };
    }
    return comp;
  }
Returns a comparator based on whether the order is ascending or not.
Has a dummy parameter to make sure generics can infer the type correctly.
contrib/src/java/org/apache/hadoop/hive/contrib/udaf/example/UDAFExampleMaxMinNUtil.java