I am trying to get from TreeMap but it return null even the key exist. HashCode and eqauls is based on word only. Comparable is based on freqency.
public sta
this code here is not working if the class word don't override properly Equals and hashcode...
TreeMap test = new TreeMap<>(); test.put(new Word("pqr",12),1); test.put(new Word("abc",2),1); Integer prq = test.get(new Word("pqr",1)); System.out.println(prq); prq = test.get(new Word("pqr",12));