MCPcopy Index your code
hub / github.com/processing/processing / putOnce

Method putOnce

core/src/processing/data/JSONObject.java:1353–1361  ·  view source on GitHub ↗

Put a key/value pair in the JSONObject, but only if the key and the value are both non-null, and only if there is not already a member with that name. @param key @param value @return this. @throws RuntimeException if the key is a duplicate, or if #put(String,Object) throws.

(String key, Object value)

Source from the content-addressed store, hash-verified

1351 * {@link #put(String,Object)} throws.
1352 */
1353 private JSONObject putOnce(String key, Object value) {
1354 if (key != null && value != null) {
1355 if (this.opt(key) != null) {
1356 throw new RuntimeException("Duplicate key \"" + key + "\"");
1357 }
1358 this.put(key, value);
1359 }
1360 return this;
1361 }
1362
1363
1364// /**

Callers 1

JSONObjectMethod · 0.95

Calls 2

optMethod · 0.95
putMethod · 0.95

Tested by

no test coverage detected