• Post Reply Bookmark Topic Watch Topic
  • New Topic

Interesting Problem?

 
Sumeet Gaikwad
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Here is my method

public java.util.List sortHashKeys(java.util.Hashtable hash){
java.util.List l = new java.util.ArrayList();
java.util.Enumeration enum = hash.keys();
while(enum.hasMoreElements()){
l.add(enum.nextElement());
}
java.util.Collections.sort(l);
return l;
}

If I use this method in another class (which is not Applet) it works fine.
But if I use this method in the Applet it gives me ClassCastException.
If I comment the Line
]java.util.Collections.sort(l);

then it works without exception.
I am not getting what the problem using theCollections.sort(l); method in Applet.
Any clues??
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!