Collapse loops using the removeIf syntax

Change-Id: I9d51ad16f375541f6cd0a7f231d5f2771d7c3ef9
This commit is contained in:
Maxime Guerreiro
2018-04-27 13:23:17 +00:00
parent 54f8947d77
commit 7d80d5764c
5 changed files with 5 additions and 31 deletions

View File

@@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.Maps;
import com.google.gerrit.metrics.Description;
import com.google.gerrit.metrics.Field;
import java.util.Iterator;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -67,12 +66,7 @@ abstract class BucketedCallback<V> implements BucketedMetric {
}
void doPrune() {
Iterator<Map.Entry<Object, ValueGauge>> i = cells.entrySet().iterator();
while (i.hasNext()) {
if (!i.next().getValue().set) {
i.remove();
}
}
cells.entrySet().removeIf(objectValueGaugeEntry -> !objectValueGaugeEntry.getValue().set);
}
void doEndSet() {