File tree 1 file changed +5
-4
lines changed
spring-core/src/main/java/org/springframework/util
1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -121,10 +121,11 @@ public abstract class ClassUtils {
121
121
primitiveWrapperTypeMap .put (Long .class , long .class );
122
122
primitiveWrapperTypeMap .put (Short .class , short .class );
123
123
124
- primitiveWrapperTypeMap .forEach ((key , value ) -> {
125
- primitiveTypeToWrapperMap .put (value , key );
126
- registerCommonClasses (key );
127
- });
124
+ // Map entry iteration is less expensive to initialize than forEach with lambdas
125
+ for (Map .Entry <Class <?>, Class <?>> entry : primitiveWrapperTypeMap .entrySet ()) {
126
+ primitiveTypeToWrapperMap .put (entry .getValue (), entry .getKey ());
127
+ registerCommonClasses (entry .getKey ());
128
+ }
128
129
129
130
Set <Class <?>> primitiveTypes = new HashSet <>(32 );
130
131
primitiveTypes .addAll (primitiveWrapperTypeMap .values ());
You can’t perform that action at this time.
0 commit comments