I have an ArrayList of String arrays which is added to like so:
List data = new ArrayList<>();
data.add(new String[] {var, lex, valor});
>
data.remove(new String[]{var, lex, valor});
Will never work because even if the arrays contain the same thing, they are not equal to each other, and the array will not be found in the list.
public void eliminarPos(String var, String lex, String valor, Integer ii) {
boolean uno=data.remove(ii);
System.out.println(uno);
}
Will not work because you pass it an Integer
instead of an int
. An Integer
is an object, so it is searching the list for that object. Change it to:
public void eliminarPos(String var, String lex, String valor, int ii) {
data.remove(ii);
}