If you have a sorted list you can use Collections. Enumeration(myList) to get it back to an enumeration... if I'm following you correctly EDIT: You can do this List l = new ArrayList(ht.keySet()); Collections. Sort(l).
If you have a sorted list you can use Collections. Enumeration(myList) to get it back to an enumeration... if I'm following you correctly.. EDIT: You can do this... List l = new ArrayList(ht.keySet()); Collections. Sort(l).
With my update in mind, I don't think there's a way to get the keys from the HT without using an Enumeration (the only HT method that really works is keys(), which returns an Enum) – Monster Sep 30 '09 at 15:10 You just missed the keySet() method... that'll give you something easier to work with... quick demo in my edited answer – danb Sep 30 '09 at 15:24 Great, thanks! I used yours (and KLE's for-loop) to go though each item. – Monster Sep 30 '09 at 17:36 List list = new ArrayList(htData.keySet()); Collections.
Sort(list); for(Object s : list) { System.out. Println(s.toString()); } – Monster Sep 30 '09 at 17:37.
If you need to iterate over the items in order of their keys, maybe it's better to use a TreeMap instead of a Hashtable. Its keySet method will return the keys in order.
Interesting. Unfortunately though, the Hashtable is a prereq. – Monster Sep 30 '09 at 17:20 In that case, use danb's solution.
– Thomas Sep 30 '09 at 17:31.
List list = // create from htData.keys() Collections. Sort(list); for(String s : list) { ...
For example, when a int I represents an enum values, doing values()i is a very simple and efficient way to find the enum instance. To go contrary-wise, the ordinal() method returns the index of an enum instance. Is there a way to output the values of an enum in alphabetical order?
Would I need a separate comparator object, or is there a built-in way to do this? What you call value is not something defined for enums in general. Here, in your context, you mean the result of getDescription().
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.