mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-27 06:23:08 +08:00
style: include WMI_WRONG_MAP_ITERATOR
(#5206)
This commit is contained in:
@ -27,9 +27,9 @@ public final class MajorityElement {
|
||||
}
|
||||
}
|
||||
List<Integer> majorityElements = new ArrayList<>();
|
||||
for (int key : numToCount.keySet()) {
|
||||
if (numToCount.get(key) >= n / 2) {
|
||||
majorityElements.add(key);
|
||||
for (final var entry : numToCount.entrySet()) {
|
||||
if (entry.getValue() >= n / 2) {
|
||||
majorityElements.add(entry.getKey());
|
||||
}
|
||||
}
|
||||
return majorityElements;
|
||||
|
Reference in New Issue
Block a user