當前位置: 首頁>>代碼示例>>Java>>正文


Java ReadableMapKeySetIterator.hasNextKey方法代碼示例

本文整理匯總了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);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:20,代碼來源:CatalystNativeJSToJavaParametersTestCase.java

示例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;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:18,代碼來源:NativeViewHierarchyOptimizer.java

示例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;
}
 
開發者ID:john1jan,項目名稱:ReactNativeSignatureExample,代碼行數:18,代碼來源:NativeViewHierarchyOptimizer.java

示例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;
}
 
開發者ID:xxsnakerxx,項目名稱:react-native-flurry-analytics,代碼行數:19,代碼來源:FlurryAnalyticsModule.java

示例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;
}
 
開發者ID:smooch,項目名稱:react-native-smooch,代碼行數:19,代碼來源:ReactNativeSmooch.java

示例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);
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:10,代碼來源:ViewManagerPropertyUpdater.java

示例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;
}
 
開發者ID:davidstoneham,項目名稱:react-native-mssql,代碼行數:34,代碼來源:MapUtil.java

示例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;
}
 
開發者ID:davidstoneham,項目名稱:react-native-mssql,代碼行數:33,代碼來源:MapUtil.java

示例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;
}
 
開發者ID:whitedogg13,項目名稱:react-native-nfc-manager,代碼行數:35,代碼來源:JsonConvert.java

示例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;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:14,代碼來源:ReactOkHttpNetworkFetcher.java

示例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;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:12,代碼來源:StyleAnimatedNode.java

示例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;
}
 
開發者ID:dangerfarms,項目名稱:react-native-batch,代碼行數:34,代碼來源:MapUtil.java

示例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;
}
 
開發者ID:humaniq,項目名稱:react-native-android-library-humaniq-api,代碼行數:29,代碼來源:ModelConverterUtils.java

示例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;
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:12,代碼來源:PropsAnimatedNode.java

示例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;
}
 
開發者ID:reneweb,項目名稱:rnrecord,代碼行數:9,代碼來源:SaveCommand.java


注:本文中的com.facebook.react.bridge.ReadableMapKeySetIterator.hasNextKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。