mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-25 05:22:39 +08:00
style: include WMI_WRONG_MAP_ITERATOR
(#5206)
This commit is contained in:
@ -38,9 +38,9 @@ public final class Mode {
|
||||
int max = Collections.max(count.values());
|
||||
ArrayList<Integer> modes = new ArrayList<>();
|
||||
|
||||
for (int num : count.keySet()) {
|
||||
if (count.get(num) == max) {
|
||||
modes.add(num);
|
||||
for (final var entry : count.entrySet()) {
|
||||
if (entry.getValue() == max) {
|
||||
modes.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
return modes.stream().mapToInt(n -> n).toArray();
|
||||
|
Reference in New Issue
Block a user