/** * Append a boolean value. This increases the array's length by one.<p> * * @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.<p> * * @param value a boolean value * @return this */ public JSONArray put(boolean value) { put(value ? Boolean.TRUE : Boolean.FALSE); return this; }
/** * Put or replace a boolean value in the JSONArray. If the index is greater * than the length of the JSONArray, then null elements will be added as * necessary to pad it out.<p> * * @param index the index * @param value a boolean value * @return this * @throws JSONException if the index is negative */ public JSONArray put(int index, boolean value) throws JSONException { put(index, value ? Boolean.TRUE : Boolean.FALSE); return this; }
/** * Put or replace a boolean value in the JSONArray. If the index is greater * than the length of the JSONArray, then null elements will be added as * necessary to pad it out.<p> * * @param index the index * @param value a boolean value * @return this * @throws JSONException if the index is negative */ public JSONArray put(int index, boolean value) throws JSONException { put(index, value ? Boolean.TRUE : Boolean.FALSE); return this; }
/** * Append an int value. This increases the array's length by one.<p> * * @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.<p> * * @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.<p> * * @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.<p> * * @param value a long value * @return this */ public JSONArray put(long value) { put(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.<p> * * @param index the index * @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.<p> * * @param index the index * @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 a value in the JSONArray, where the value will be a * JSONArray which is produced from a Collection.<p> * * @param value a Collection value * @return this */ public JSONArray put(Collection<Object> 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.<p> * * @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.<p> * * @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.<p> * * @param value a Collection value * @return this */ public JSONArray put(Collection value) { put(new JSONArray(value)); return this; }
/** * Append a double value. This increases the array's length by one.<p> * * @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.<p> * * @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.<p> * * @param index the index must be between 0 and length() - 1 * @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<Object> value) throws JSONException { put(index, new JSONArray(value)); return this; }
/** * Put a value in the JSONArray, where the value will be a * JSONObject which is produced from a Map.<p> * * @param index the index must be between 0 and length() - 1 * @param value the Map value * @return this * @throws JSONException if the index is negative or if the the value is * an invalid number */ public JSONArray put(int index, Map<?, ?> value) throws JSONException { put(index, new JSONObject(value)); return this; }
/** * Produce a JSONArray containing the names of the elements of this JSONObject.<p> * * @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.<p> * * @return a JSONArray containing the key strings, or null if the JSONObject is empty. */ public JSONArray names() { JSONArray ja = new JSONArray(); Iterator keys = keys(); while (keys.hasNext()) { ja.put(keys.next()); } return ja.length() == 0 ? null : ja; }