Hello,
In one of my program, I use a TreeMap to stock an object of type Foo. But I need time to recover given the smallest object Foo, then I have redefined the method compares of the Comparator interface. But all of this does not work for me. Please check my code
Please help me with this. Thanks in advance.Code:Public class mtrmp extends TreeMap implements Comparator { Public mtrmp() { great(); } Public Intl compares(Object obj1, Object obj2) { test test1 = (test) obj1; Foo foo2 = (test) obj2; / / Here I compare whether test1 <foo2 or test1> foo2 and foo2 = test1 .... } }
Bookmarks