本文整理匯總了Java中com.facebook.react.bridge.ReadableMapKeySetIterator.hasNextKey方法的典型用法代碼示例。如果您正苦於以下問題:Java ReadableMapKeySetIterator.hasNextKey方法的具體用法?Java ReadableMapKeySetIterator.hasNextKey怎麽用?Java ReadableMapKeySetIterator.hasNextKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.facebook.react.bridge.ReadableMapKeySetIterator
的用法示例。
在下文中一共展示了ReadableMapKeySetIterator.hasNextKey方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testMapIterateOverMapWithBasicTypes
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
public void testMapIterateOverMapWithBasicTypes() {
mCatalystInstance.getJSModule(TestJSToJavaParametersModule.class).returnMapWithBasicTypes();
waitForBridgeAndUIIdle();
List<ReadableMap> calls = mRecordingTestModule.getMapCalls();
assertEquals(1, calls.size());
ReadableNativeMap map = (ReadableNativeMap) calls.get(0);
assertNotNull(map);
ReadableMapKeySetIterator mapIterator = map.keySetIterator();
Set<String> keys = new HashSet<String>();
while (mapIterator.hasNextKey()) {
keys.add(mapIterator.nextKey());
}
Set<String> expectedKeys = new HashSet<String>(
Arrays.asList("stringKey", "doubleKey", "intKey", "booleanKey", "nullKey"));
assertEquals(keys, expectedKeys);
}
示例2: isLayoutOnlyAndCollapsable
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
private static boolean isLayoutOnlyAndCollapsable(@Nullable ReactStylesDiffMap props) {
if (props == null) {
return true;
}
if (props.hasKey(ViewProps.COLLAPSABLE) && !props.getBoolean(ViewProps.COLLAPSABLE, true)) {
return false;
}
ReadableMapKeySetIterator keyIterator = props.mBackingMap.keySetIterator();
while (keyIterator.hasNextKey()) {
if (!ViewProps.isLayoutOnly(props.mBackingMap, keyIterator.nextKey())) {
return false;
}
}
return true;
}
示例3: isLayoutOnlyAndCollapsable
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
private static boolean isLayoutOnlyAndCollapsable(@Nullable ReactStylesDiffMap props) {
if (props == null) {
return true;
}
if (props.hasKey(ViewProps.COLLAPSABLE) && !props.getBoolean(ViewProps.COLLAPSABLE, true)) {
return false;
}
ReadableMapKeySetIterator keyIterator = props.mBackingMap.keySetIterator();
while (keyIterator.hasNextKey()) {
if (!ViewProps.isLayoutOnly(keyIterator.nextKey())) {
return false;
}
}
return true;
}
示例4: toMap
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
private static Map<String, String> toMap(@Nullable ReadableMap readableMap) {
if (readableMap == null) {
return null;
}
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
if (!iterator.hasNextKey()) {
return null;
}
Map<String, String> result = new HashMap<>();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
result.put(key, readableMap.getString(key));
}
return result;
}
示例5: getUserProperties
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
private Map<String, Object> getUserProperties(ReadableMap properties) {
ReadableMapKeySetIterator iterator = properties.keySetIterator();
Map<String, Object> userProperties = new HashMap<>();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
ReadableType type = properties.getType(key);
if (type == ReadableType.Boolean) {
userProperties.put(key, properties.getBoolean(key));
} else if (type == ReadableType.Number) {
userProperties.put(key, properties.getDouble(key));
} else if (type == ReadableType.String) {
userProperties.put(key, properties.getString(key));
}
}
return userProperties;
}
示例6: updateProps
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
public static <T extends ReactShadowNode> void updateProps(T node, ReactStylesDiffMap props) {
ShadowNodeSetter<T> setter = findNodeSetter(node.getClass());
ReadableMap propMap = props.mBackingMap;
ReadableMapKeySetIterator iterator = propMap.keySetIterator();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
setter.setProperty(node, key, props);
}
}
示例7: toJSONObject
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
public static JSONObject toJSONObject(ReadableMap readableMap) throws JSONException {
JSONObject jsonObject = new JSONObject();
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
ReadableType type = readableMap.getType(key);
switch (type) {
case Null:
jsonObject.put(key, null);
break;
case Boolean:
jsonObject.put(key, readableMap.getBoolean(key));
break;
case Number:
jsonObject.put(key, readableMap.getDouble(key));
break;
case String:
jsonObject.put(key, readableMap.getString(key));
break;
case Map:
jsonObject.put(key, MapUtil.toJSONObject(readableMap.getMap(key)));
break;
case Array:
jsonObject.put(key, ArrayUtil.toJSONArray(readableMap.getArray(key)));
break;
}
}
return jsonObject;
}
示例8: toMap
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
public static Map<String, Object> toMap(ReadableMap readableMap) {
Map<String, Object> map = new HashMap<>();
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
ReadableType type = readableMap.getType(key);
switch (type) {
case Null:
map.put(key, null);
break;
case Boolean:
map.put(key, readableMap.getBoolean(key));
break;
case Number:
map.put(key, readableMap.getDouble(key));
break;
case String:
map.put(key, readableMap.getString(key));
break;
case Map:
map.put(key, MapUtil.toMap(readableMap.getMap(key)));
break;
case Array:
map.put(key, ArrayUtil.toArray(readableMap.getArray(key)));
break;
}
}
return map;
}
示例9: reactToJSON
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
public static JSONObject reactToJSON(ReadableMap readableMap) throws JSONException {
JSONObject jsonObject = new JSONObject();
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
while(iterator.hasNextKey()){
String key = iterator.nextKey();
ReadableType valueType = readableMap.getType(key);
switch (valueType){
case Null:
jsonObject.put(key,JSONObject.NULL);
break;
case Boolean:
jsonObject.put(key, readableMap.getBoolean(key));
break;
case Number:
try {
jsonObject.put(key, readableMap.getInt(key));
} catch(Exception e) {
jsonObject.put(key, readableMap.getDouble(key));
}
break;
case String:
jsonObject.put(key, readableMap.getString(key));
break;
case Map:
jsonObject.put(key, reactToJSON(readableMap.getMap(key)));
break;
case Array:
jsonObject.put(key, reactToJSON(readableMap.getArray(key)));
break;
}
}
return jsonObject;
}
示例10: getHeaders
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
private Map<String, String> getHeaders(ReadableMap readableMap) {
if (readableMap == null) {
return null;
}
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
Map<String, String> map = new HashMap<>();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
String value = readableMap.getString(key);
map.put(key, value);
}
return map;
}
示例11: StyleAnimatedNode
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
StyleAnimatedNode(ReadableMap config, NativeAnimatedNodesManager nativeAnimatedNodesManager) {
ReadableMap style = config.getMap("style");
ReadableMapKeySetIterator iter = style.keySetIterator();
mPropMapping = new HashMap<>();
while (iter.hasNextKey()) {
String propKey = iter.nextKey();
int nodeIndex = style.getInt(propKey);
mPropMapping.put(propKey, nodeIndex);
}
mNativeAnimatedNodesManager = nativeAnimatedNodesManager;
}
示例12: toJSONObject
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
public static JSONObject toJSONObject(ReadableMap readableMap) throws JSONException {
JSONObject jsonObject = new JSONObject();
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
ReadableType type = readableMap.getType(key);
switch (type) {
case Null:
jsonObject.put(key, null);
break;
case Boolean:
jsonObject.put(key, readableMap.getBoolean(key));
break;
case Number:
jsonObject.put(key, readableMap.getDouble(key));
break;
case String:
jsonObject.put(key, readableMap.getString(key));
break;
case Map:
jsonObject.put(key, MapUtil.toJSONObject(readableMap.getMap(key)));
break;
case Array:
jsonObject.put(key, ArrayUtil.toJSONArray(readableMap.getArray(key)));
break;
}
}
return jsonObject;
}
示例13: convertMapToJson
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
private static JSONObject convertMapToJson(ReadableMap readableMap) throws JSONException {
JSONObject object = new JSONObject();
ReadableMapKeySetIterator iterator = readableMap.keySetIterator();
while (iterator.hasNextKey()) {
String key = iterator.nextKey();
switch (readableMap.getType(key)) {
case Null:
object.put(key, JSONObject.NULL);
break;
case Boolean:
object.put(key, readableMap.getBoolean(key));
break;
case Number:
object.put(key, readableMap.getDouble(key));
break;
case String:
object.put(key, readableMap.getString(key));
break;
case Map:
object.put(key, convertMapToJson(readableMap.getMap(key)));
break;
case Array:
object.put(key, convertArrayToJson(readableMap.getArray(key)));
break;
}
}
return object;
}
示例14: PropsAnimatedNode
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
PropsAnimatedNode(ReadableMap config, NativeAnimatedNodesManager nativeAnimatedNodesManager) {
ReadableMap props = config.getMap("props");
ReadableMapKeySetIterator iter = props.keySetIterator();
mPropMapping = new HashMap<>();
while (iter.hasNextKey()) {
String propKey = iter.nextKey();
int nodeIndex = props.getInt(propKey);
mPropMapping.put(propKey, nodeIndex);
}
mNativeAnimatedNodesManager = nativeAnimatedNodesManager;
}
示例15: getPropKeys
import com.facebook.react.bridge.ReadableMapKeySetIterator; //導入方法依賴的package包/類
private List<String> getPropKeys(ReadableMap props) {
List<String> keys = new ArrayList<>();
ReadableMapKeySetIterator iterator = props.keySetIterator();
while(iterator.hasNextKey()) {
keys.add(iterator.nextKey());
}
return keys;
}