Simplify DefaultContextCache implementation by using entrySet().removeIf()

This commit is contained in:
Sam Brannen
2026-01-14 13:47:44 +01:00
parent b5c2003c51
commit 01a57a7219
@@ -341,11 +341,7 @@ public class DefaultContextCache implements ContextCache {
}
// Remove empty entries from the hierarchy map.
for (Map.Entry<MergedContextConfiguration, Set<MergedContextConfiguration>> entry : this.hierarchyMap.entrySet()) {
if (entry.getValue().isEmpty()) {
this.hierarchyMap.remove(entry.getKey());
}
}
this.hierarchyMap.entrySet().removeIf(entry -> entry.getValue().isEmpty());
}
private void remove(List<MergedContextConfiguration> removedContexts, MergedContextConfiguration key) {