For example, in the remove (obj) function. The problem is that the number in brackets is read as an index. In this case, remove (index) is in progress.
How can this be changed?
Example:
public class L16_Test { public static void main(String[] args) { LinkedList<Integer> arr = new LinkedList<Integer>(); for (int i = 0; i < 6; i++) arr.add(i+5); out.println(arr); // output: [5, 6, 7, 8, 9, 10] arr.remove(5); out.println(arr); // output: [5, 6, 7, 8, 9] } }