I have an issue regarding arrayList element while in looping I have two lists : the first list contains 2 elements : A and B. the second list contains 4 element : A1,B1,B2,B3 Now, what I want is to get from both the list to match their respective elements For example: A -> A1 B -> B1 B -> B2 B -> B3
public class MyArrayList {
public static void main(String[] args) {
List listA = new ArrayList<>();
List listB = new ArrayList<>();
listA.add("ElementA");
listA.add("ElementB");
listB.add("ElementA1");
listB.add("ElementB1");
listB.add("ElementB2");
listB.add("ElementB3");
listB.add("ElementB4");
for (int i = 0; i < listA.size(); i++) {
for (int j = 0; i < listB.size(); j++) {
System.out.println(listA.get(i) + "-->" + listB.get(j));
}
}
}
}
List<String>for example.