I'm trying to get a value with the key. I'm using get() method. My key is an object composed with int and String. So I make and object
HashMap<Keys,String> test = readFile(fileName2);
Keys myKey = new Keys(2,"SM");
test.get(myKey);
And I received null. When I look at debbuging mode or when I print keySet I received something like this
[Keys@d9c6e2, Keys@10285d8, Keys@c3dd7e]
although my key should be
[1,"GM", 2,"SM", 3"PM"]
why the key look like this Keys@d9c6e2
instead of 2,"SM"?
and how to get the value with the key 2,"SM"
?
I override toString methid in Keys . It looks better but still i have null value and im sure there is some value.
Keys myKey = new Keys(2,"GL-G--T");
System.out.println(myKey.toString());
System.out.println(test.get(myKey.toString()));
Set keyset = test.keySet();
System.out.println(keyset);
2,GL-G--T
null
[3,PNSN--G, 2,GL-G--T, 1,SM]