Lab 7 Comparator

CS203
Spring 2017
March 28, 2017

Goals

Activities

public static Comparator<Country> createComparatorByName(final boolean increasing)

public static Comparator<Country> createComparatorByArea(final boolean increasing)

to the Country class. The methods should return instances of anonymous classes that implement the Comparator interface type. The boolean parameters indicate whether the comparison should be in increasing or decreasing order. The parameters are declared final so that you can access them in your compare methods.

NOTE: You do not need to implement Comparable<> to use the String method CompareTo(). However, you may need to implement Comparator<> to create Comparators.

Please include Javadoc comments and tests. This is meant to be a longer lab than the animation lab.