Provide both the type and value that failed conversion. Tries not to
"toString" large value types like Arrays or Maps. For those types it
will just output the type and not a value.
When called from the constructor, the individual items in the
collection/array are wrapped as done originally before the `putAll`
methods were added.
However this commit changes how `putAll` works. The items are no longer
wrapped in order to keep consistency with the other `put` methods.
However this can lead to inconsistencies with expectations. For example
code like this will create a mixed JSONArray, some items wrapped, others
not:
```java
SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
JSONArray jArr = new JSONArray(myArr); // these will be wrapped
// these will not be wrapped
jArr.putAll(new SomeBean[]{ new SomeBean(3), new SomeBean(4) });
```
For consistency, it would be recommended that the above code is changed
to look like 1 of 2 ways.
Option 1:
```Java
SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
JSONArray jArr = new JSONArray();
jArr.putAll(myArr); // will not be wrapped
// these will not be wrapped
jArr.putAll(new SomeBean[]{ new SomeBean(3), new SomeBean(4) });
// our jArr is now consistent.
```
Option 2:
```Java
SomeBean[] myArr = new SomeBean[]{ new SomeBean(1), new SomeBean(2) };
JSONArray jArr = new JSONArray(myArr); // these will be wrapped
// these will be wrapped
jArr.putAll(new JSONArray(new SomeBean[]{ new SomeBean(3), new
SomeBean(4) }));
// our jArr is now consistent.
```
* Adds a copy constructor for JSONArray
* Updates the JSONArray.addAll(Object) method to be more lenient
* Adds support for JSONArray.putAll of generic Iterables
* Adds support for JSONArray.putAll of another JSONArray
- Introduced JSONObject(int) constructor.
- int > Initial capacity of the underlying data structure
- Test for new introduced JSONArray(int) constructor.
1. Checked with input parameter: 0
2. Checked with input parameter: positive number
3. Checked with positive number input parameter and compared length
4. If input parameter is negative number JSONException is thrown:
JSONArray initial capacity cannot be negative.