Please, what is wrong in code below? Why do I get compiler error "cannot
find symbol variable date" in compareTo method of class TestItem?
Thank you!
public class Test<TestItem> implements Iterable<TestItem> {
public class TestItem implements Comparable<TestItem> {
public Date date;
public TestItem() {
}
public int compareTo(TestItem anotherItem) {
return date.compareTo(anotherItem.date);
^
*** Cannot find symbol: variable date ***___|
}
}
private Vector<TestItem> items;
public Test() {
items = new Vector<TestItem>();
}
public Iterator<TestItem> iterator() {
return items.iterator();
}
}
Simon - 11 Oct 2006 12:25 GMT
Vojta schrieb:
> Please, what is wrong in code below? Why do I get compiler error "cannot
> find symbol variable date" in compareTo method of class TestItem?
Let me answer your question with a counter question. What is the intention of
the following line?
> public class Test<TestItem> implements Iterable<TestItem> {
^^^^^^^^ ^^^^^^^^
Cheers,
Simon