001package horstmann.ch04_sort1; 002import java.util.ArrayList; 003import java.util.Collections; 004 005public class CountrySortTester 006{ 007 public static void main(String[] args) 008 { 009 ArrayList<Country> countries = new ArrayList<Country>(); 010 countries.add(new Country("Uruguay", 176220)); 011 countries.add(new Country("Thailand", 514000)); 012 countries.add(new Country("Belgium", 30510)); 013 014 Collections.sort(countries); 015 // Now the array list is sorted by area 016 for (Country c : countries) 017 System.out.println(c.getName() + " " + c.getArea()); 018 } 019}