I met a problem when I tried to get values from Map. Here's details.
I declared this structure:
Map<String, Map<String, IrregularWord>> result4 = new TreeMap<>();
As keys, I used strings like 2_5_1
, 3_5_1
, 21_4_2
and etc. When I filled result4
, I had this result .
Then I tried to read all values from result4
and make with them something:
for (String key : result4.keySet()) {
Map<String, IrregularWord> words = result4.get(key);
// other code
}
When key == 2_5_1
I had words.size() == 14
not 9 as it's in real result4
.
Update: correct value for this example is 9
.
My question is why I got incorrect result? Maybe problem in hash algorithm of Map?
Thanks for help.