mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-16 02:38:29 +08:00
Initialize internals of ReadableNativeMap with the correct initial capacity
Summary: This diff initializes internals maps of ReadableNativeMap with the correct initial capacity Reviewed By: kathryngray Differential Revision: D13970989 fbshipit-source-id: d104fcbaf938f377a0138b839375c4bc146f1732
This commit is contained in:
committed by
Facebook Github Bot
parent
aa3fc0910a
commit
185320db23
@@ -54,8 +54,9 @@ public class ReadableNativeMap extends NativeMap implements ReadableMap {
|
||||
if (mLocalMap == null) {
|
||||
Object[] values = Assertions.assertNotNull(importValues());
|
||||
mJniCallCounter++;
|
||||
mLocalMap = new HashMap<>();
|
||||
for(int i = 0; i< mKeys.length; i++) {
|
||||
int length = mKeys.length;
|
||||
mLocalMap = new HashMap<>(length);
|
||||
for(int i = 0; i< length; i++) {
|
||||
mLocalMap.put(mKeys[i], values[i]);
|
||||
}
|
||||
}
|
||||
@@ -80,8 +81,9 @@ public class ReadableNativeMap extends NativeMap implements ReadableMap {
|
||||
if (mLocalTypeMap == null) {
|
||||
Object[] types = Assertions.assertNotNull(importTypes());
|
||||
mJniCallCounter++;
|
||||
mLocalTypeMap = new HashMap<>();
|
||||
for(int i = 0; i< mKeys.length; i++) {
|
||||
int length = mKeys.length;
|
||||
mLocalTypeMap = new HashMap<>(length);
|
||||
for(int i = 0; i< length; i++) {
|
||||
mLocalTypeMap.put(mKeys[i], (ReadableType) types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user