/** * Append a boolean value. This increases the array's length by one. * * @param value * A boolean value. * @return this. */ public JSONArray put(boolean value) { put(value ? Boolean.TRUE : Boolean.FALSE); return this; }
/** * Append a boolean value. This increases the array's length by one. * * @param value * A boolean value. * @return this. */ public JSONArray put(boolean value) { put(value ? Boolean.TRUE : Boolean.FALSE); return this; }
/** * Append an int value. This increases the array's length by one. * * @param value * An int value. * @return this. */ public JSONArray put(int value) { put(new Integer(value)); return this; }
/** * Append an int value. This increases the array's length by one. * * @param value * An int value. * @return this. */ public JSONArray put(int value) { put(new Integer(value)); return this; }
/** * Append an long value. This increases the array's length by one. * * @param value * A long value. * @return this. */ public JSONArray put(long value) { put(new Long(value)); return this; }
/** * Append an long value. This increases the array's length by one. * * @param value * A long value. * @return this. */ public JSONArray put(long value) { put(new Long(value)); return this; }
/** * Put or replace a double value. If the index is greater than the length of * the JSONArray, then null elements will be added as necessary to pad it out. * * @param index * The subscript. * @param value * A double value. * @return this. * @throws JSONException * If the index is negative or if the value is not finite. */ public JSONArray put(int index, double value) throws JSONException { put(index, new Double(value)); return this; }
/** * Put or replace an int value. If the index is greater than the length of the * JSONArray, then null elements will be added as necessary to pad it out. * * @param index * The subscript. * @param value * An int value. * @return this. * @throws JSONException * If the index is negative. */ public JSONArray put(int index, int value) throws JSONException { put(index, new Integer(value)); return this; }
/** * Put or replace a long value. If the index is greater than the length of the * JSONArray, then null elements will be added as necessary to pad it out. * * @param index * The subscript. * @param value * A long value. * @return this. * @throws JSONException * If the index is negative. */ public JSONArray put(int index, long value) throws JSONException { put(index, new Long(value)); return this; }
/** * Put or replace an int value. If the index is greater than the length of the * JSONArray, then null elements will be added as necessary to pad it out. * * @param index * The subscript. * @param value * An int value. * @return this. * @throws JSONException * If the index is negative. */ public JSONArray put(int index, int value) throws JSONException { put(index, new Integer(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a JSONArray which is * produced from a Collection. * * @param value * A Collection value. * @return this. */ public JSONArray put(Collection<?> value) { put(new JSONArray(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a JSONArray which is * produced from a Collection. * * @param value * A Collection value. * @return this. */ public JSONArray put(Collection<?> value) { put(new JSONArray(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a JSONObject which is * produced from a Map. * * @param value * A Map value. * @return this. */ public JSONArray put(Map<?, ?> value) { put(new JSONObject(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a JSONObject which is * produced from a Map. * * @param value * A Map value. * @return this. */ public JSONArray put(Map<?, ?> value) { put(new JSONObject(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a JSONArray which is * produced from a Collection. * * @param index * The subscript. * @param value * A Collection value. * @return this. * @throws JSONException * If the index is negative or if the value is not finite. */ public JSONArray put(int index, Collection<?> value) throws JSONException { put(index, new JSONArray(value)); return this; }
/** * Append a double value. This increases the array's length by one. * * @param value * A double value. * @throws JSONException * if the value is not finite. * @return this. */ public JSONArray put(double value) throws JSONException { Double d = new Double(value); JSONObject.testValidity(d); put(d); return this; }
/** * Append a double value. This increases the array's length by one. * * @param value * A double value. * @throws JSONException * if the value is not finite. * @return this. */ public JSONArray put(double value) throws JSONException { Double d = new Double(value); JSONObject.testValidity(d); put(d); return this; }
/** * Put a value in the JSONArray, where the value will be a JSONArray which is * produced from a Collection. * * @param index * The subscript. * @param value * A Collection value. * @return this. * @throws JSONException * If the index is negative or if the value is not finite. */ public JSONArray put(int index, Collection<?> value) throws JSONException { put(index, new JSONArray(value)); return this; }
/** * Produce a JSONArray containing the names of the elements of this * JSONObject. * * @return A JSONArray containing the key strings, or null if the JSONObject * is empty. */ public JSONArray names() { JSONArray ja = new JSONArray(); Iterator<String> keys = keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }
/** * Produce a JSONArray containing the names of the elements of this * JSONObject. * * @return A JSONArray containing the key strings, or null if the JSONObject * is empty. */ public JSONArray names() { JSONArray ja = new JSONArray(); Iterator<String> keys = keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }