Revert to Map entry iteration for less expensive static initialization
Issue: SPR-17169
This commit is contained in:
parent
cfb1ed1009
commit
df51ff0386
|
|
@ -121,10 +121,11 @@ public abstract class ClassUtils {
|
|||
primitiveWrapperTypeMap.put(Long.class, long.class);
|
||||
primitiveWrapperTypeMap.put(Short.class, short.class);
|
||||
|
||||
primitiveWrapperTypeMap.forEach((key, value) -> {
|
||||
primitiveTypeToWrapperMap.put(value, key);
|
||||
registerCommonClasses(key);
|
||||
});
|
||||
// Map entry iteration is less expensive to initialize than forEach with lambdas
|
||||
for (Map.Entry<Class<?>, Class<?>> entry : primitiveWrapperTypeMap.entrySet()) {
|
||||
primitiveTypeToWrapperMap.put(entry.getValue(), entry.getKey());
|
||||
registerCommonClasses(entry.getKey());
|
||||
}
|
||||
|
||||
Set<Class<?>> primitiveTypes = new HashSet<>(32);
|
||||
primitiveTypes.addAll(primitiveWrapperTypeMap.values());
|
||||
|
|
|
|||
Loading…
Reference in New Issue