I am new to java. It seems really simple but I can't understand why this is happening.
for (int i = -3; i < 3; i++){
set.add(i);
list.add(i);
}
for (int i = 0; i < 3; i++){
set.remove(i);
list.remove(i);
}
When they print themselves, set prints [-3, -2, -1](desired output) whereas list prints [-2, 0, 2](Not desired output). For list.remove() method, since it is overloading it considers its argument as index, not object. Is this right? Why is this happening and how do I fix list to print desired output using function binding?
Thanks in advance.