posted 10 years ago
Hashtable shouldn't have an order. The order in which elements appear depend on the insertion order of the elements, the hash function, the capacity of the table, and maybe some other factors.
It seems you are working with some legacy code. Hashtable, Enumeration and Vector are all obsolete in favor of HashMap, Iterator and List.
If you want to sort the elements in some way, you could do this: Map<Integer, Object> map = new TreeMap<>(table);
You now have a map that contains the same elements as the hash table, sorted by natural order of the keys.