// Java 1.7 style
Collections.sort( lst, new Comparator<String>() {
     public int compare( String s1, String s2 ) {
         return s1.length() - s2.length();
     }
});

// Java 1.8 style with lambda
Collections.sort( lst, ( s1, s2 ) -> s1.length() - s2.length() );
// The compiler cleverly figures out that s1 and s2 must be Strings
// from the generic type of lst, e.g. ArrayList<String>.
// It also figures out you are implementing a Comparator<String>, and the compare method.
// Java 1.8 Collections.sort is just the ordinary Java 1.7-style Collections.sort.
// Java 1.8 Comparator<T> is just the ordinary Java 1.7-style Comparator<T> with
// and extra annotation @FunctionalInterface