public static List orderByStringLength(Collection collection){
  List ordered=new ArrayList(collection);
  Collections.sort(ordered,new StringLengthComparator());
  return ordered;
}

public static List orderByStringLength ( Collection collection ) { List ordered = new ArrayList ( collection ) ; Collections . sort ( ordered , new StringLengthComparator ( ) ) ; return ordered ; }
returns a list of strings in the order of string length . longest string is in front of the list .
