Hi All,
Merry Christams & Happy New Year 2017.
I have used the 'dictionary' collection in C# successfully. It's my first time using a diction in Java and I am having issues. The issue is that the Hashmap does not recognize the key entered and I do not know why. Not sure if I am missing anything. I tried debugging and yes I can see in the logcat the key and value (the value is a customed object)
Here's my code sample:
Map<String, SomeClass> dictionary = new Hashmap<>();
I been adding stuff as follows:
dictionary.put(key, object);
BUT when I try to retrieve an object using a key it always returns null. And when I check if the key exist as follows:
if(dictionary.containsKey("keyname"))
{
}
it says null.
Any help will be appreciated. I hate wasting time on these kind of things
Eric
Merry Christams & Happy New Year 2017.
I have used the 'dictionary' collection in C# successfully. It's my first time using a diction in Java and I am having issues. The issue is that the Hashmap does not recognize the key entered and I do not know why. Not sure if I am missing anything. I tried debugging and yes I can see in the logcat the key and value (the value is a customed object)
Here's my code sample:
Map<String, SomeClass> dictionary = new Hashmap<>();
I been adding stuff as follows:
dictionary.put(key, object);
BUT when I try to retrieve an object using a key it always returns null. And when I check if the key exist as follows:
if(dictionary.containsKey("keyname"))
{
}
it says null.
Any help will be appreciated. I hate wasting time on these kind of things
Eric