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

public class CountingComparatorTester
{
   public static void main(String[] args)
   {
      class MyCountingComparator extends CountingComparator
      {
         public int doCompare(Object o1, Object o2)
         {
            return o1.toString().length() - o2.toString().length();
         }
      }

      ArrayList<String> words = new ArrayList<String>();
      words.add("Mary");
      words.add("had");
      words.add("a");
      words.add("little");
      words.add("lamb");
      words.add("its");
      words.add("fleece");
      words.add("was");
      words.add("white");
      words.add("as");
      words.add("snow");
      
      CountingComparator comp = new MyCountingComparator();
      String result = Collections.min(words, comp);
      System.out.println(comp.getCounter());
      System.out.println("Expected: 10");
   }
}
