MCPcopy Index your code
hub / github.com/benfry/processing4 / putOnce

Method putOnce

core/src/processing/data/JSONObject.java:1407–1415  ·  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

1405 * {@link #put(String,Object)} throws.
1406 */
1407 private JSONObject putOnce(String key, Object value) {
1408 if (key != null && value != null) {
1409 if (this.opt(key) != null) {
1410 throw new RuntimeException("Duplicate key \"" + key + "\"");
1411 }
1412 this.put(key, value);
1413 }
1414 return this;
1415 }
1416
1417
1418// /**

Callers 1

JSONObjectMethod · 0.95

Calls 2

optMethod · 0.95
putMethod · 0.95

Tested by

no test coverage detected