review changes
This commit is contained in:
parent
fdf873daf7
commit
91ea35ee38
|
@ -21,12 +21,15 @@ public class SortHashMap {
|
|||
arrayListSortByValue();
|
||||
arrayListSortByKey();
|
||||
|
||||
treeSetByKey();
|
||||
treeSetByValue();
|
||||
|
||||
sortStream();
|
||||
|
||||
sortGuava();
|
||||
|
||||
addDuplicates();
|
||||
|
||||
treeSetByKey();
|
||||
treeSetByValue();
|
||||
|
||||
}
|
||||
|
||||
private static void sortGuava() {
|
||||
|
@ -63,10 +66,7 @@ public class SortHashMap {
|
|||
TreeMap<String, Employee> sorted = new TreeMap<>(map);
|
||||
sorted.putAll(map);
|
||||
|
||||
for (Map.Entry<String, Employee> entry : sorted.entrySet()) {
|
||||
System.out.println("Key = " + entry.getKey() +
|
||||
", Value = " + entry.getValue());
|
||||
}
|
||||
sorted.entrySet().forEach(System.out::println);
|
||||
|
||||
}
|
||||
|
||||
|
@ -94,4 +94,11 @@ public class SortHashMap {
|
|||
Employee employee4 = new Employee(2L, "George");
|
||||
map.put(employee4.getName(), employee4);
|
||||
}
|
||||
|
||||
private static void addDuplicates() {
|
||||
Employee employee5 = new Employee(1L, "Mher");
|
||||
map.put(employee5.getName(), employee5);
|
||||
Employee employee6 = new Employee(22L, "Annie");
|
||||
map.put(employee6.getName(), employee6);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue