Alpdog14 0 Light Poster

I was wondering if someone can help me, I have this snippet of code that I know is giving me an issue but cannot figure why:

public D put (K key, D data){
        
        DataTreeNode<K,D> dtn = insert(key);
        if(key.equals(dtn.key())) [B]return dtn.data();[/B]
        else return null;
   }

I know I want the return dtn.data(); save dtn.data() in a temp variable then update the data using dtn.setData(data)
now return the old saved value of dtn.data but my temp variables are not working. Can anyone help me?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.