I was having issues adding my ArrayList items to a linked list. It was working perfectly fine at first but for some reason, doesn't want to act right now I transferred the information to my computer.
Basically, what is happening is that instead of 2 items from my array list being moved to my linked list, 4 items move (the two items copying themselves).
Here's my code:
for(Customer obj : customers){
remaining.addAll(obj.getIndex(), customers);
System.out.println(remaining);
//System.out.println(obj.getIndex() + " Customer: " + obj.getType());
}
My output for that: [Slow Customer 0, Slow Customer 1] [Slow Customer 0, Slow Customer 0, Slow Customer 1, Slow Customer 1]
I understand why I'm getting two lists BUT my main question to you all is why am I getting the second output.
******Disclaimer: when I printed the remaining on the outside, I only got the second list.*******