I need to keep 2 completly different data object structures in sync. I was hoping to do this with a hash map where I keep references to some object variables.
So basically what I need is this:
Data1 d1 = new Data1(); d1.setSomeValue(4.5)
Data1 d2 = new Data2(); d2.setSomeValue(6.7)
HashMap h = new HashMap(); h.put("data1" , d1.SomeValue) h.get("data1") = d2.getSomeValue
But the SomeValue variable does not get updated in the d1 object instead I just update the value in the HashMap. Is there a way to update the d1 object ?
I know there are better ways to solve this under normal circumstances. But this in a special problem becaus d2 is a tree structure and when something changes in the tree I only get the node id thus I need the hash map approach.