com.google.gson.JsonArray has add method which will append the element. If I would like to add at specific index, how to do that?
I tried with this kind of code to add element at 0th index. I am looking for something better without instantiating a new JsonArray.
JsonArray newArray = new JsonArray();
newArray.add(new JsonPrimitive(3));
for (int i = 0; i < myArray.size(); i++) {
newArray.add(myArray.get(i));
}