I'm declaring the following two classes:
public class formula
{
ArrayList<values> var= new ArrayList<values>;
}
public class values
{
int val;
void addval(int val1)
{
val=val1;
}
}
I am declaring an ArrayList of type formula.
ArrayList<formula> S= new ArrayList<formula>;
When I try to execute the following statement:
S.get(i).var.remove(b);
where i is a loop variable
I don't get any error and it compiles fine, but doesn't delete the instance of var(b) for formula(i). The value still remains. What is wrong? I am not using Iterators at all, just a loop to traverse through all the instances of formula().
b is an integer. Essentially the index of the element in the var arraylist I'm trying to delete.