mirror of
https://github.com/bspeice/itcs4180
synced 2025-04-20 23:01:34 -04:00
Finish debugging, everything now working correctly.
This commit is contained in:
parent
8b893cd06a
commit
c3def78187
@ -70,6 +70,8 @@ public class PartTwo {
|
|||||||
for (Vehicle v : uniqueVehicles)
|
for (Vehicle v : uniqueVehicles)
|
||||||
if (vehicleCount.containsKey(vehicleMapString(v)))
|
if (vehicleCount.containsKey(vehicleMapString(v)))
|
||||||
vehicleCount.put(vehicleMapString(v), vehicleCount.get(vehicleMapString(v)) + 1);
|
vehicleCount.put(vehicleMapString(v), vehicleCount.get(vehicleMapString(v)) + 1);
|
||||||
|
else
|
||||||
|
vehicleCount.put(vehicleMapString(v), 1);
|
||||||
|
|
||||||
// Print out the results of our counting
|
// Print out the results of our counting
|
||||||
// Convert to Set for iteration - http://stackoverflow.com/questions/1066589/java-iterate-through-hashmap
|
// Convert to Set for iteration - http://stackoverflow.com/questions/1066589/java-iterate-through-hashmap
|
||||||
@ -93,11 +95,11 @@ public class PartTwo {
|
|||||||
Collections.sort(vehicleCountList, Collections.reverseOrder(new VehicleEntryComparator()));
|
Collections.sort(vehicleCountList, Collections.reverseOrder(new VehicleEntryComparator()));
|
||||||
|
|
||||||
System.out.println("--------------------------------------------------" +
|
System.out.println("--------------------------------------------------" +
|
||||||
"\nTop 10 Models:" +
|
"\nTop 10 Models:\n" +
|
||||||
"--------------------------------------------------");
|
"--------------------------------------------------");
|
||||||
// Go to the top 10 results, or full list, whichever comes first
|
// Go to the top 10 results, or full list, whichever comes first
|
||||||
for (int i = 0; i < vehicleCountList.size() && i < 10; i++)
|
for (int i = 0; i < vehicleCountList.size() && i < 10; i++)
|
||||||
System.out.println(i + "-" + vehicleCountList.get(i).getKey() + ":" +
|
System.out.println((i + 1) + "-" + vehicleCountList.get(i).getKey() + ":" +
|
||||||
vehicleCountList.get(i).getValue());
|
vehicleCountList.get(i).getValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -119,7 +121,7 @@ public class PartTwo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String vehicleMapString(Vehicle v) {
|
private static String vehicleMapString(Vehicle v) {
|
||||||
return v.getModelName() + " - " + v.getManufacturerName();
|
return v.getModelYear() + "-" + v.getManufacturerName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user