Create HashMap as cache for objects, problem with key object?

The code you posted can't leads to null keys in the mCachedPaths map. Thus you should look outside from this code to see who is putting these null keys.

The code you posted can't leads to null keys in the mCachedPaths map. Thus you should look outside from this code to see who is putting these null keys. You also have to override Equals and HashCode methods in your CachePathKey class using the mPathID and the mZf fields (the fields that makes your object unique).

IDE such has eclipse allows you (from contextual menu in Eclipse) to automatically override these methods using end user selected class members. I also strongly recommend the reading of Chapter9 in Effective Java 2nd edition book.

You need to override equals and hashcode method for CachePathKey, Since you have unique identified for object do a equal test on mPathID.

All of them together are unique, a can have (mPathID = 1, mZF = 1) or (mPathID=1,mZF=0.9f) – PaweÅ‚ Plewa Aug 3 at 10:48 you need to uniquely identify your object what ever condition you make – Jigar Joshi Aug 3 at 10:51 works like charm! Thanks – PaweÅ‚ Plewa Aug 3 at 11:04 why I cant accept both your answers? – PaweÅ‚ Plewa Aug 3 at 11:05 there is a time limit before which you can't accept the answer – Jigar Joshi Aug 3 at 11:06.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions