@@ -152,11 +152,29 @@ public JSONArray(Collection<?> collection) {
152152 this (collection , 0 , new JSONParserConfiguration ());
153153 }
154154
155+ /**
156+ * Construct a JSONArray from a Collection.
157+ *
158+ * @param collection
159+ * A Collection.
160+ * @param jsonParserConfiguration
161+ * Configuration object for the JSON parser
162+ */
155163 public JSONArray (Collection <?> collection , JSONParserConfiguration jsonParserConfiguration ) {
156164 this (collection , 0 , jsonParserConfiguration );
157165 }
158166
159- protected JSONArray (Collection <?> collection , int recursionDepth , JSONParserConfiguration jsonParserConfiguration ) {
167+ /**
168+ * Construct a JSONArray from a collection with recursion depth.
169+ *
170+ * @param collection
171+ * A Collection.
172+ * @param recursionDepth
173+ * Variable for tracking the count of nested object creations.
174+ * @param jsonParserConfiguration
175+ * Configuration object for the JSON parser
176+ */
177+ JSONArray (Collection <?> collection , int recursionDepth , JSONParserConfiguration jsonParserConfiguration ) {
160178 if (recursionDepth > jsonParserConfiguration .getMaxNestingDepth ()) {
161179 throw new JSONException ("JSONArray has reached recursion depth limit of " + jsonParserConfiguration .getMaxNestingDepth ());
162180 }
@@ -1362,7 +1380,7 @@ public JSONArray put(int index, Map<?, ?> value) throws JSONException {
13621380 * @param value
13631381 * The Map value.
13641382 * @param jsonParserConfiguration
1365- * Configuration for recursive depth
1383+ * Configuration object for the JSON parser
13661384 * @return
13671385 * @throws JSONException
13681386 * If the index is negative or if the value is an invalid
@@ -1811,8 +1829,7 @@ public boolean isEmpty() {
18111829 * {@code true} to call {@link JSONObject#wrap(Object)} for each item,
18121830 * {@code false} to add the items directly
18131831 * @param recursionDepth
1814- * variable to keep the count of how nested the object creation is happening.
1815- *
1832+ * Variable for tracking the count of nested object creations.
18161833 */
18171834 private void addAll (Collection <?> collection , boolean wrap , int recursionDepth , JSONParserConfiguration jsonParserConfiguration ) {
18181835 this .myArrayList .ensureCapacity (this .myArrayList .size () + collection .size ());
@@ -1852,8 +1869,14 @@ private void addAll(Iterable<?> iter, boolean wrap) {
18521869 * Add an array's elements to the JSONArray.
18531870 *
18541871 * @param array
1872+ * Array. If the parameter passed is null, or not an array,
1873+ * JSONArray, Collection, or Iterable, an exception will be
1874+ * thrown.
18551875 * @param wrap
1876+ * {@code true} to call {@link JSONObject#wrap(Object)} for each item,
1877+ * {@code false} to add the items directly
18561878 * @throws JSONException
1879+ * If not an array or if an array value is non-finite number.
18571880 */
18581881 private void addAll (Object array , boolean wrap ) throws JSONException {
18591882 this .addAll (array , wrap , 0 );
@@ -1867,7 +1890,10 @@ private void addAll(Object array, boolean wrap) throws JSONException {
18671890 * JSONArray, Collection, or Iterable, an exception will be
18681891 * thrown.
18691892 * @param wrap
1893+ * {@code true} to call {@link JSONObject#wrap(Object)} for each item,
1894+ * {@code false} to add the items directly
18701895 * @param recursionDepth
1896+ * Variable for tracking the count of nested object creations.
18711897 */
18721898 private void addAll (Object array , boolean wrap , int recursionDepth ) {
18731899 addAll (array , wrap , recursionDepth , new JSONParserConfiguration ());
@@ -1883,8 +1909,8 @@ private void addAll(Object array, boolean wrap, int recursionDepth) {
18831909 * {@code true} to call {@link JSONObject#wrap(Object)} for each item,
18841910 * {@code false} to add the items directly
18851911 * @param recursionDepth
1886- * Variable to keep the count of how nested the object creation is happening .
1887- * @param recursionDepth
1912+ * Variable for tracking the count of nested object creations .
1913+ * @param jsonParserConfiguration
18881914 * Variable to pass parser custom configuration for json parsing.
18891915 * @throws JSONException
18901916 * If not an array or if an array value is non-finite number.
0 commit comments