Use ConcurrentHashMap.newKeySet

In places where a ConcurrentHashMap was used as a set by wrapping it
with Collections.newSetFromMap, switch to just using the set returned
by ConcurrentHashMap.newKeySet directly.

Closes gh-32294
This commit is contained in:
Patrick Strawderman
2024-02-19 08:57:33 -08:00
committed by Sam Brannen
parent ff9c7141c5
commit f9fe8efb2e
14 changed files with 16 additions and 29 deletions

View File

@@ -20,7 +20,6 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Proxy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -136,7 +135,7 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport
@Nullable
private BeanFactory beanFactory;
private final Set<String> targetSourcedBeans = Collections.newSetFromMap(new ConcurrentHashMap<>(16));
private final Set<String> targetSourcedBeans = ConcurrentHashMap.newKeySet(16);
private final Map<Object, Object> earlyBeanReferences = new ConcurrentHashMap<>(16);