I have some objects each hold a list of variables, and a list which holds all variables of these objects, for example
class A
{
List<Var> varList;
}
class B
{
List<A> aList;
List<Var> allVarOfAs;
// it is a common list which holds the members of varList of all members of the aList
}
Now if an object from varList
in an an object of aList
(an A
object in B
) is removed, how can I update the common list allVarOfAs
?
What is the pattern for such situation?