public static Tuple max(Iterator tuples,String field,Comparator cmp){
  Tuple t=null, tmp;
  Object min=null;
  if (tuples.hasNext()) {
    t=(Tuple)tuples.next();
    min=t.get(field);
  }
  while (tuples.hasNext()) {
    tmp=(Tuple)tuples.next();
    Object obj=tmp.get(field);
    if (cmp.compare(obj,min) > 0) {
      t=tmp;
      min=obj;
    }
  }
  return t;
}

public static Tuple max ( Iterator tuples , String field , Comparator cmp ) { Tuple t = null , tmp ; Object min = null ; if ( tuples . hasNext ( ) ) { t = ( Tuple ) tuples . next ( ) ; min = t . get ( field ) ; } while ( tuples . hasNext ( ) ) { tmp = ( Tuple ) tuples . next ( ) ; Object obj = tmp . get ( field ) ; if ( cmp . compare ( obj , min ) > 0 ) { t = tmp ; min = obj ; } } return t ; }
get the tuple with the maximum data field value .
