Created
March 6, 2019 13:32
-
-
Save EbbeVang/5c123b67421c3d48f2a9dd97fc05fbbb to your computer and use it in GitHub Desktop.
Exercise for EC2: implement the citizen class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the main method | |
ArrayList<Citizen> citizens = new ArrayList<>(); | |
citizens.add(new Citizen("Liv", "Vang", 2911071234L)); | |
citizens.add(new Citizen("Liv", "Andersen", 1505011234L)); | |
citizens.add(new Citizen("Ebbe", "Vang", 2312721234L)); | |
citizens.add(new Citizen("Ebbe", "Vang", 2412721234L)); | |
Collections.sort(citizens); | |
System.out.println(citizens); | |
/* | |
expected output: | |
[Ebbe, Vang, 23/12 - 7212, Ebbe, Vang, 24/12 - 7212, Liv, Andersen, 15/05 - 0112, Liv, Vang, 29/11 - 0712] | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment