I am told to have a list of words sorted by length, and those that have the same length are sorted by alphabetical order. This is what I have for the method that does that s
You can use Java 8's lamba utilities to make concise functions that prevent the clutter of using comparator classes, like so:
Collections.sort(words, (string1, string2) -> Integer.compare(string1.length(), string2.length());
-Example taken from Effective Java by Joshua Bloch