I have two ArrayLists
ArrayList<Integer> values = new ArrayList<Integer>();
values.add(9);
That's one, here's the other:
ArrayList<Integer> values2 = new ArrayList<Integer>();
for(int j = 1; j < 10; j++){
values2.add(j);
}
How can I compare the two and remove 9 from the second ArrayList? I tried using a foreach statement but I kept getting
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 9, Size: 1
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
This had been a head-peck for some hours now and I appreciate any help you can offer