Java Map question

Posted by user552961 on Stack Overflow See other posts from Stack Overflow or by user552961
Published on 2010-12-25T18:42:31Z Indexed on 2010/12/25 18:54 UTC
Read the original article Hit count: 155

Filed under:
|

I have one Map that contains some names and numbers

Map<String,Integer> abc = new TreeMap<String,Integer>();

It works fine. I can put some values in it but when I call it in different class it gives me wrong order. For example:

I putted

abc.put("a",1);
abc.put("b",5);
abc.put("c",3);

some time it returns the order (b,a,c) and some time (a,c,b).

What is wrong with it? Is there any step that I am missing when I call this map?

© Stack Overflow or respective owner

Related posts about java

Related posts about data-structures