1. Java 8 Comparators example added

2. Comparator.comparing example added
This commit is contained in:
gschambial
2017-11-24 13:48:55 +05:30
parent 0a8fd5ed2c
commit 66a1c32e13
4 changed files with 84 additions and 15 deletions
@@ -7,7 +7,7 @@ import java.util.List;
public class PlayerSorter {
public static void main(String[] args) {
List<Player> footballTeam = new ArrayList<Player>();
Player player1 = new Player(59, "John", 20);
Player player2 = new Player(67, "Roger", 22);
@@ -15,11 +15,11 @@ public class PlayerSorter {
footballTeam.add(player1);
footballTeam.add(player2);
footballTeam.add(player3);
System.out.println("Before Sorting : " + footballTeam);
Collections.sort(footballTeam);
System.out.println("After Sorting : " + footballTeam);
}
}