@Test public void testToMapWithNull() throws Exception { assertEquals(0, JSONUtils.toMap(null).size()); }
public static Map<String, String> toMap(JSONObject json) { if (json == null) return Collections.emptyMap(); HashMap<String, String> map = new HashMap<String, String>(); for (Iterator<String> iterator = json.keys(); iterator.hasNext();) { String key = iterator.next(); map.put(key, json.optString(key)); } return map; }
JSONUtils { public static Map<String, String> toMap(JSONObject json) { if (json == null) return Collections.emptyMap(); HashMap<String, String> map = new HashMap<String, String>(); for (Iterator<String> iterator = json.keys(); iterator.hasNext();) { String key = iterator.next(); map.put(key, json.optString(key)); } return map; } }
JSONUtils { public static Map<String, String> toMap(JSONObject json) { if (json == null) return Collections.emptyMap(); HashMap<String, String> map = new HashMap<String, String>(); for (Iterator<String> iterator = json.keys(); iterator.hasNext();) { String key = iterator.next(); map.put(key, json.optString(key)); } return map; } private  JSONUtils(); }
JSONUtils { public static Map<String, String> toMap(JSONObject json) { if (json == null) return Collections.emptyMap(); HashMap<String, String> map = new HashMap<String, String>(); for (Iterator<String> iterator = json.keys(); iterator.hasNext();) { String key = iterator.next(); map.put(key, json.optString(key)); } return map; } private  JSONUtils(); static JObject mapToJSON(Map<String, String> map); static JValue setToJSON(Set<String> set); static JValue filtersToJSON(ResourceListQuery query, ListProvidersService listProvidersService,
          Organization org); static JValue filtersToJSONSeriesWriteAccess(ResourceListQuery query, ListProvidersService listProvidersService,
          Organization org, Map<String, String> series); static JSONObject fromMap(Map<String, String> map); static Map<String, String> toMap(JSONObject json); }
JSONUtils { public static Map<String, String> toMap(JSONObject json) { if (json == null) return Collections.emptyMap(); HashMap<String, String> map = new HashMap<String, String>(); for (Iterator<String> iterator = json.keys(); iterator.hasNext();) { String key = iterator.next(); map.put(key, json.optString(key)); } return map; } private  JSONUtils(); static JObject mapToJSON(Map<String, String> map); static JValue setToJSON(Set<String> set); static JValue filtersToJSON(ResourceListQuery query, ListProvidersService listProvidersService,
          Organization org); static JValue filtersToJSONSeriesWriteAccess(ResourceListQuery query, ListProvidersService listProvidersService,
          Organization org, Map<String, String> series); static JSONObject fromMap(Map<String, String> map); static Map<String, String> toMap(JSONObject json);  }