java - Treemap sorting -


I have this piece of code:

  Personal Final Static TreeMap & lt; String, UserNetification & gt; USER_NOTIFICATION_MAP = New Trimmer & lt; String, User Notification & gt; (); // string idstring = "1" filling the map using the services; Iterator = USER_NOTIFICATION_MAP.entrySet () Iterator (); While (this hasNext ()) {map.Entry pairs = (Map.Entry) it.next (); IdString = pairs.getKey () ToString (); Println (idString); } For the map with the following pairs: 2 - User Notice, 3 - User Information, 4 - User Information, 5 - User Information, 6 - User Information, 7 - User Notifications, 8 - User Information, 9 - User Notification, 10 - User Notification  

Output from code: 10 2 3 4 5 6 7 8 9

How is this possible, see the fact Did Treepap have all the data in his chemistry? I think the value 10 should be at the end of the key list.

If you want to sort, then mark the trademark Its class is classified based on lexicography (alphabetically), so any thing beginning with 1 comes before it starts at 2.

Your map numeric , gives you the TreeMap & lt; Integer, UserNotification & gt;

should be used

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -