I have a scene which shows a table with 2 columns. Each columns has its own cell factory class to render the cell value. When the table is rendered, the cell factory classes are created (one for each cell). Now when the user navigates to another scene, how to clear the memory allocated for the cell factory classes. I cleared the column data's , but how to remove each object created for each cell. I tried the following code, but it throws an error saying :
Caused by: java.lang.UnsupportedOperationException
at com.sun.javafx.collections.UnmodifiableListSet$1.remove(UnmodifiableListSet.java:88)
My code to remove the objects alloted for cell factories:
Set<Node> colNodes = mytableview.lookupAll("#columnname1");
Iterator<Node> itr = colNodes.iterator();
while(itr.hasNext()) {
Node n = itr.next();
colNodes.remove(n);
//itr.remove();
}
And same for column 2. but it throws an exception.
Any idea how to clear those objects.