Name: rmT116609 Date: 08/26/2003
A DESCRIPTION OF THE PROBLEM :
I think that the Set returned by TreeMap.keySet should implement SortedSet, because it's actually a sorted Set.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
C:\java\src>java Test
Exception in thread "main" java.lang.ClassCastException: java.util.TreeMap$1
at Test.main(Test.java:7)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
public class Test {
public static void main(String[] args) {
TreeMap map=new TreeMap();
map.put("Hello","World");
SortedSet keySet=(SortedSet)map.keySet();
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
Directly use the methods of TreeMap.
(Incident Review ID: 164293)
======================================================================