Groovy web console

subscribe to the feed Subscribe
to this
site

Copy List Items

Published 3 weeks ago by Ram with tags List Copy ArrayList
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import java.util.ArrayList;
import java.util.List;

ArrayList listA = new ArrayList()
def list = []

for (int i=0; i<3; i++) {
    list.add(i);
    list.add("Rama");
    list.add("SAP");
    listA.add(list.clone())

   list.clear()
}

print listA
print listA.size()