private void updateHashIndex() { int size = names.size(); for (int i = 0; i < size; i++) { table.add(names.get(i), i); } }
/** * Appends a new member to the end of this object, with the specified name and the specified JSON * value. * <p> * This method <strong>does not prevent duplicate names</strong>. Calling this method with a name * that already exists in the object will append another member with the same name. In order to * replace existing members, use the method <code>set(name, value)</code> instead. However, * <strong> <em>add</em> is much faster than <em>set</em></strong> (because it does not need to * search for existing members). Therefore <em>add</em> should be preferred when constructing new * objects. * </p> * * @param name * the name of the member to add * @param value * the value of the member to add, must not be <code>null</code> * @return the object itself, to enable method chaining */ public JsonObject add(String name, JsonValue value) { if (name == null) { throw new NullPointerException("name is null"); } if (value == null) { throw new NullPointerException("value is null"); } table.add(name, names.size()); names.add(name); values.add(value); return this; }
values.set(index, value); } else { table.add(name, names.size()); names.add(name); values.add(value);
values.set( index, value ); } else { table.add( name, names.size() ); names.add( name ); values.add( value );
values.set(index, value); } else { table.add(name, names.size()); names.add(name); values.add(value);
/** * Appends a new member to the end of this object, with the specified name and the specified JSON * value. * <p> * This method <strong>does not prevent duplicate names</strong>. Calling this method with a name * that already exists in the object will append another member with the same name. In order to * replace existing members, use the method <code>set(name, value)</code> instead. However, * <strong> <em>add</em> is much faster than <em>set</em></strong> (because it does not need to * search for existing members). Therefore <em>add</em> should be preferred when constructing new * objects. * </p> * * @param name * the name of the member to add * @param value * the value of the member to add, must not be <code>null</code> * @return the object itself, to enable method chaining */ public JsonObject add( String name, JsonValue value ) { if( name == null ) { throw new NullPointerException( "name is null" ); } if( value == null ) { throw new NullPointerException( "value is null" ); } table.add( name, names.size() ); names.add( name ); values.add( value ); return this; }
/** * Appends a new member to the end of this object, with the specified name and the specified JSON * value. * <p> * This method <strong>does not prevent duplicate names</strong>. Calling this method with a name * that already exists in the object will append another member with the same name. In order to * replace existing members, use the method <code>set(name, value)</code> instead. However, * <strong> <em>add</em> is much faster than <em>set</em></strong> (because it does not need to * search for existing members). Therefore <em>add</em> should be preferred when constructing new * objects. * </p> * * @param name * the name of the member to add * @param value * the value of the member to add, must not be <code>null</code> * @return the object itself, to enable method chaining */ public JsonObject add(String name, JsonValue value) { if (name == null) { throw new NullPointerException("name is null"); } if (value == null) { throw new NullPointerException("value is null"); } table.add(name, names.size()); names.add(name); values.add(value); return this; }
values.set(index, value); } else { table.add(name, names.size()); names.add(name); values.add(value);
/** * Appends a new member to the end of this object, with the specified name and the specified JSON * value. * <p> * This method <strong>does not prevent duplicate names</strong>. Calling this method with a name * that already exists in the object will append another member with the same name. In order to * replace existing members, use the method <code>set(name, value)</code> instead. However, * <strong> <em>add</em> is much faster than <em>set</em></strong> (because it does not need to * search for existing members). Therefore <em>add</em> should be preferred when constructing new * objects. * </p> * * @param name * the name of the member to add * @param value * the value of the member to add, must not be <code>null</code> * @return the object itself, to enable method chaining */ public JsonObject add(String name, JsonValue value) { if (name == null) { throw new NullPointerException("name is null"); } if (value == null) { throw new NullPointerException("value is null"); } table.add(name, names.size()); names.add(name); values.add(value); return this; }
private void updateHashIndex() { int size = names.size(); for( int i = 0; i < size; i++ ) { table.add( names.get( i ), i ); } }
private void updateHashIndex() { int size = names.size(); for (int i = 0; i < size; i++) { table.add(names.get(i), i); } }
private void updateHashIndex() { int size = names.size(); for (int i = 0; i < size; i++) { table.add(names.get(i), i); } }