I have two array lists that hold x amount of equal elements, the idea is to combine both arraylists into one, but I want to add element by element in index order, currently I have this code listed below, but its not very efficient:
ArrayList <String> listA = ["a", "c", "e"]
ArrayList <String> listB = ["b", "d","f"]
ArrayList <String> listC;
for (int i = 0; i < listA.size() + listB.size(); i++){
listC.add(listA.get(i));
lictC.add(listB.get(i));
}
return listC;
output = ["a", "b", "c", "d", "e", "f"];