I have a tree structure in this format:
Index1
|
--Key1
--Value1
Index2
|
--Key2
--Value2
Key
and Value
objects are children of Index
objects and there are no index objects in the tree.
I'm maintaining array lists for Index
objects (indexList
), Key
objects (keyList
) and Value
objects (valueList
).
viewer
is an object of TreeViewer
.
My aim is to remove Index object and the code responsible for this action is:
String indexName = text.getText();
for(int i =0; i< model.indexList.size(); i++)
{
if(model.indexList.get(i).getName().equals(indexName))
{
Index temp = model.indexList.get(i);
int noOfKeys = temp.keyList.size();
int noOfValues = temp.valueList.size();
for(int j=0; j<noOfKeys ; j++ )
{
temp.keyList.remove(j);
temp.valueList.remove(j);
}
model.indexList.remove(i);
break;
}
}
viewer.refresh();
When I perform the remove action the node gets removed but with stack-overflow error.
Please let me know where I went wrong.