You could make a SortedSet out of the Map.Entry, providing a suitable comparator at creation time. Something like this:
SortedSet<Entry<Integer, String>> set = new TreeSet<Entry<Integer, String>> (theComparator); set.addAll(Map.entrySet()); private static class TheComparator implements Comparator<Entry<Integer, String>> { public int compare(Entry<Integer, String> e1, Entry<Integer, String> e2) { if (e1.getValue() < e2.getValue()) { return -1; } else if (e1.getValue() > e2.getValue()) { return 1; } else { return e1.getKey().compareTo(e2.getKey()); } } } Also it might be worth checking Apache Commons Collections as it (almost) for sure has what you need. David -----Original Message----- From: Andreja [mailto:[EMAIL PROTECTED] Sent: quinta-feira, 5 de Julho de 2007 18:13 To: Struts Users Mailing List Subject: Re: Populate a s:select Hi. LinkedHashMap will preserve order in wich elements are added to LinkedHashMap, and checkboxlist (radiobuttons, etc) will be displayed in that order. > > If I have a Hashtable<Integer,String> with the > > following data: > > 1,"One" > > 2,"Two" > > 11,"Eleven" > > Is it possible to make the select box display the > > data sorting by id or sorting by value? > > Only if you apply ordering somehow; hashes are > non-ordered by default. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]