mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
changed Map<String, ?> method parameters to Map<?,?>
changed Iterator to foreach loop in JSONArray ctor JSONArray(Collection<?> collection) and JSONObject ctor JSONObject(Map<?,?> map)
This commit is contained in:
parent
409eb9f292
commit
25b5aa7ef2
2 changed files with 13 additions and 18 deletions
|
@ -154,10 +154,9 @@ public class JSONArray implements Iterable<Object> {
|
|||
public JSONArray(Collection<?> collection) {
|
||||
this.myArrayList = new ArrayList<Object>();
|
||||
if (collection != null) {
|
||||
Iterator<?> iter = collection.iterator();
|
||||
while (iter.hasNext()) {
|
||||
this.myArrayList.add(JSONObject.wrap(iter.next()));
|
||||
}
|
||||
for (Object o: collection){
|
||||
this.myArrayList.add(JSONObject.wrap(o));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -799,7 +798,7 @@ public class JSONArray implements Iterable<Object> {
|
|||
* A Map value.
|
||||
* @return this.
|
||||
*/
|
||||
public JSONArray put(Map<String, ?> value) {
|
||||
public JSONArray put(Map<?, ?> value) {
|
||||
this.put(new JSONObject(value));
|
||||
return this;
|
||||
}
|
||||
|
@ -920,7 +919,7 @@ public class JSONArray implements Iterable<Object> {
|
|||
* If the index is negative or if the the value is an invalid
|
||||
* number.
|
||||
*/
|
||||
public JSONArray put(int index, Map<String, ?> value) throws JSONException {
|
||||
public JSONArray put(int index, Map<?, ?> value) throws JSONException {
|
||||
this.put(index, new JSONObject(value));
|
||||
return this;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue