Skip to content

Commit 01a57a7

Browse files
committed
Simplify DefaultContextCache implementation by using entrySet().removeIf()
1 parent b5c2003 commit 01a57a7

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

spring-test/src/main/java/org/springframework/test/context/cache/DefaultContextCache.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,7 @@ public void remove(MergedContextConfiguration key, @Nullable HierarchyMode hiera
341341
}
342342

343343
// Remove empty entries from the hierarchy map.
344-
for (Map.Entry<MergedContextConfiguration, Set<MergedContextConfiguration>> entry : this.hierarchyMap.entrySet()) {
345-
if (entry.getValue().isEmpty()) {
346-
this.hierarchyMap.remove(entry.getKey());
347-
}
348-
}
344+
this.hierarchyMap.entrySet().removeIf(entry -> entry.getValue().isEmpty());
349345
}
350346

351347
private void remove(List<MergedContextConfiguration> removedContexts, MergedContextConfiguration key) {

0 commit comments

Comments
 (0)