package com.aemreunal.helper.json;

/*
 * *********************** *
 * Copyright (c) 2015      *
 *                         *
 * This code belongs to:   *
 *                         *
 * @author Ahmet Emre Ünal *
 * S001974                 *
 *                         *
 * aemreunal@gmail.com     *
 * emre.unal@ozu.edu.tr    *
 *                         *
 * aemreunal.com           *
 * *********************** *
 */

import net.minidev.json.JSONArray;

import java.util.ArrayList;

public class JsonArrayBuilder {
    private ArrayList<Object> jsonList = new ArrayList<>();

    JsonArrayBuilder() {
    }

    public JsonArrayBuilder add(Object value) {
        jsonList.add(value);
        return this;
    }

    public JSONArray build() {
        JSONArray array = new JSONArray();
        array.addAll(jsonList);
        return array;
    }
}

@@ -477,16 +477,45 @@
 rayList;
+%0Aimport java.util.Collection;
 %0A%0Apublic
@@ -672,21 +672,131 @@
 (Object 
-value
+item) %7B%0A        jsonList.add(item);%0A        return this;%0A    %7D%0A%0A    public JsonArrayBuilder addAll(Collection items
 ) %7B%0A    
@@ -815,14 +815,17 @@
 .add
-(value
+All(items
 );%0A 

Add collections to JSON arrays