public static <T extends Comparable<T>>int compareLists(List<T> a,List<T> b){
  final Iterator<T> left=a.iterator();
  final Iterator<T> right=b.iterator();
  if (left.hasNext()) {
    if (!right.hasNext()) {
      return -1;
    }
    final T l=left.next();
    final T r=right.next();
    final int c=l.compareTo(r);
    if (c != 0) {
      return c;
    }
  }
  if (right.hasNext()) {
    return 1;
  }
  return 0;
}

public static < T extends Comparable < T > > int compareLists ( List < T > a , List < T > b ) { final Iterator < T > left = a . iterator ( ) ; final Iterator < T > right = b . iterator ( ) ; if ( left . hasNext ( ) ) { if ( ! right . hasNext ( ) ) { return - 1 ; } final T l = left . next ( ) ; final T r = right . next ( ) ; final int c = l . compareTo ( r ) ; if ( c != 0 ) { return c ; } } if ( right . hasNext ( ) ) { return 1 ; } return 0 ; }
compare two lists of things which extend the same type < t > .
