/** * Returns the value of the member with the specified name in this object. If this object contains * multiple members with the given name, this method will return the last one. * * @param name * the name of the member whose value is to be returned * @return the value of the last member with the specified name, or <code>null</code> if this * object does not contain a member with that name */ public JsonValue get(String name) { if (name==null) { throw new NullPointerException("name is null"); } int index=indexOf(name); return index!=-1 ? values.get(index) : null; }
/** * Returns the value of the member with the specified name in this object. If this object contains * multiple members with the given name, this method will return the last one. * * @param name * the name of the member whose value is to be returned * @return the value of the last member with the specified name, or <code>null</code> if this * object does not contain a member with that name */ public JsonValue get(String name) { if (name==null) { throw new NullPointerException("name is null"); } int index=indexOf(name); return index!=-1 ? values.get(index) : null; }
/** * Removes a member with the specified name from this object. If this object contains multiple * members with the given name, only the last one is removed. If this object does not contain a * member with the specified name, the object is not modified. * * @param name * the name of the member to remove * @return the object itself, to enable method chaining */ public JsonObject remove(String name) { if (name==null) { throw new NullPointerException("name is null"); } int index=indexOf(name); if (index!=-1) { table.remove(index); names.remove(index); values.remove(index); } return this; }
/** * Removes a member with the specified name from this object. If this object contains multiple * members with the given name, only the last one is removed. If this object does not contain a * member with the specified name, the object is not modified. * * @param name * the name of the member to remove * @return the object itself, to enable method chaining */ public JsonObject remove(String name) { if (name==null) { throw new NullPointerException("name is null"); } int index=indexOf(name); if (index!=-1) { table.remove(index); names.remove(index); values.remove(index); } return this; }
throw new NullPointerException("value is null"); int index=indexOf(name); if (index!=-1) { values.set(index, value);
throw new NullPointerException("value is null"); int index=indexOf(name); if (index!=-1) { values.set(index, value);