1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

JSONObject and JSONArray initialization:

JSONObject(Map<String, ?> map) allows to initialize the JSONObject with
a Map<String, String>

JSONArray(Collection<?> collection) allows to initialize a JSONArray
with a Collection<JSONObject>
This commit is contained in:
Lukas Treyer 2015-10-04 23:17:30 +02:00
parent b0191a6acf
commit 0afd26623c
2 changed files with 7 additions and 5 deletions

View file

@ -151,10 +151,10 @@ public class JSONArray implements Iterable<Object> {
* @param collection
* A Collection.
*/
public JSONArray(Collection<Object> collection) {
public JSONArray(Collection<?> collection) {
this.myArrayList = new ArrayList<Object>();
if (collection != null) {
Iterator<Object> iter = collection.iterator();
Iterator<?> iter = collection.iterator();
while (iter.hasNext()) {
this.myArrayList.add(JSONObject.wrap(iter.next()));
}