Variable 'maps"initializer ' new Arraylist<>0 is redundant
时间: 2024-05-05 08:15:30 浏览: 169
intent传递ArrayList<T>
As an AI language model, I cannot see the whole context of your code, but based on the error message, it seems like you are initializing an ArrayList with an unnecessary argument.
In Java, when you create a new ArrayList, you can either leave it empty or initialize it with elements. The syntax for creating an empty ArrayList is:
```java
ArrayList<Type> listName = new ArrayList<>();
```
In this case, the ArrayList is initialized with no elements.
However, if you want to initialize the ArrayList with elements, you can pass them as arguments, like this:
```java
ArrayList<Type> listName = new ArrayList<>(Arrays.asList(element1, element2, ...));
```
In your case, the error message suggests that you are initializing the ArrayList with an argument of 0, which is redundant because an empty ArrayList is already created with the first syntax. Therefore, you can simply remove the argument and initialize the ArrayList like this:
```java
ArrayList<Type> listName = new ArrayList<>();
```
I hope this helps!
阅读全文