Use Collection factory methods when applicable

This commit replaces the use of Collections.unmodifiableList/Set/Map
with the corresponding 'of(...)' factory methods introduced in Java 9.

Closes gh-27824
This commit is contained in:
Marten Deinum
2021-12-16 07:50:41 +01:00
committed by Sam Brannen
parent ab240f5d8e
commit 941b6af9ac
14 changed files with 68 additions and 137 deletions

View File

@@ -23,7 +23,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -65,15 +64,7 @@ public class ReflectivePropertyAccessor implements PropertyAccessor {
private static final Set<Class<?>> ANY_TYPES = Collections.emptySet();
private static final Set<Class<?>> BOOLEAN_TYPES;
static {
Set<Class<?>> booleanTypes = new HashSet<>(4);
booleanTypes.add(Boolean.class);
booleanTypes.add(Boolean.TYPE);
BOOLEAN_TYPES = Collections.unmodifiableSet(booleanTypes);
}
private static final Set<Class<?>> BOOLEAN_TYPES = Set.of(Boolean.class, Boolean.TYPE);
private final boolean allowWrite;