@Override public Collection<String> getPropertyKeys(final Object obj) { return ((JSONObject) obj).keys(); }
@Override public Collection<String> getPropertyKeys(final Object obj) { return ((JSONObject) obj).keys(); }
@Override public Collection<String> getPropertyKeys(final Object obj) { return ((JSONObject) obj).keys(); }
/** * Merge obj1 with obj2. Obj2 has predominance. * * @param obj1 * @param obj2 * @return null if obj1 is null. Else return obj1 merged with obj2 */ public final static JSONObject merge(JSONObject obj1, JSONObject obj2) { if (obj1 == null) return null; if (obj2 == null) return obj1; for (String key : obj2.keys()) { obj1.put(key, obj2.get(key)); } return null; }
/** * Prints the JSONObject using the session. * * @since 5.2.0 */ @Override void print(JSONPrintSession session) { session.printSymbol('{'); session.indent(); boolean comma = false; for (String key : keys()) { if (comma) session.printSymbol(','); session.newline(); session.printQuoted(key); session.printSymbol(':'); printValue(session, nameValuePairs.get(key)); comma = true; } session.outdent(); if (comma) session.newline(); session.printSymbol('}'); }
/** * Prints the JSONObject using the session. * * @since 5.2.0 */ @Override void print(JSONPrintSession session) { session.printSymbol('{'); session.indent(); boolean comma = false; for (String key : keys()) { if (comma) session.printSymbol(','); session.newline(); session.printQuoted(key); session.printSymbol(':'); printValue(session, nameValuePairs.get(key)); comma = true; } session.outdent(); if (comma) session.newline(); session.printSymbol('}'); }
for (String key : existing.keys()) { events.put(key, existing.get(key));