Hello y'all. I am in the midst of an exciting project, and I've hit a little bump. I'm trying to do a 'deep copy' of a TreeMap<String, State> so that I can work with one (delete, insert, etc...) and preserve the other for later. Instead of having to code up a messy method to do this, I'm wondering if clone() or something else, for that matter, might do the trick.
I was thinking something like this:
public TreeMap<String, State> copyStates(TreeMap<String, State> mapping)
{
TreeMap<String, State> copiedStates = new TreeMap<String, State>();
copiedStates = (TreeMap<String, State>)mapping.clone();
return copiedStates;
}
Thank you in advance!