package collections2; import java.util.*; // Java Collections and Iterators example public class PhoneBook { public static void main(String[] args) { List
phoneList= new ArrayList(); phoneList.add( new Address("Ta'id", "Holmes", "+43 1 58801-49360") ); phoneList.add( new Address("Vicky", "Weichsler", "+43 1 783 212") ); phoneList.add( new Address("Christian", "Toth", "+43 1 587 27 63") ); Collections.sort( phoneList ); // output for (Address a: phoneList) { System.out.println(a); } } }