method List.add(int,List<Integer>) is not applicable
时间: 2024-05-05 12:22:14 浏览: 122
This error message typically occurs when you try to call the `add` method of a `List` with an `int` as the first argument, followed by a `List<Integer>` as the second argument.
The `add` method of a `List` expects the first argument to be an `int` representing the index at which to add the element, followed by the element to be added.
To fix this error, you should change the first argument to the index at which you want to add the `List<Integer>` to the existing `List`. You can do this using the `addAll` method instead of `add`. Here's an example:
```
List<Integer> list1 = new ArrayList<>();
List<Integer> list2 = Arrays.asList(1, 2, 3);
int index = 0;
list1.addAll(index, list2);
```
This will add the elements of `list2` to `list1` at the specified index.
阅读全文