Sort an array list of strings by increasing length. Hint: Supply a Comparator.

Complete the following file:

StringLengthComparator.java

Use the following file:

StringSortDemo.java

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;

/**
   Sort an array list of strings by increasing length.
*/
public class StringSortDemo
{
   public static void main(String[] args)
   {
      ArrayList<String> list = new ArrayList<String>();
      Scanner in = new Scanner(System.in);
      
      boolean done = false;      
      while (!done)
      {
         System.out.println("Enter a string or a blank line to quit");
         String input = in.nextLine();
         if (input.equals(""))
            done = true;
         else
            list.add(input);
      }

      Collections.sort(list, new StringLengthComparator());
      System.out.println(list);
   }
}