TreeMap behaves abnormally
<pre><code>import java.util.*;    
public class Test {
        public static void main(String[] args) {

            Map&lt;String,String&gt; map = new TreeMap&lt;String,String&gt;();
            map.put("10", "America");
            map.put("1", "Australia");
            map.put("2", "India");
            map.put("11", "China");

            System.out.println(map);

        }
    }
</code></pre>

<p>When running the above code snippet,in console I am getting the output as :</p>

<p><strong><code>{1=Australia, 10=America, 11=China, 2=India}</code></strong></p>

<p>But I am expecting output as</p>

<p><strong><code>{1=Australia, 2=India, 10=America, 11=China}</code></strong></p>

<p>But when changing the logic as mentioned below inside above main()  </p>

<pre><code> Map&lt;String,String&gt; map = new TreeMap&lt;String,String&gt;();
        map.put("US", "America");
        map.put("AUS", "Australia");
        map.put("IN", "India");
        map.put("CH", "China");

    System.out.println(map);
</code></pre>

<p>I am getting the desired output </p>

<p><strong><code>({AUS=Australia, CH=China, IN=India, US=America})</code></strong></p>

<p>As per my understanding TreeMap's entrySet() method returns a  set view of the mappings contained in the map. The set's iterator returns the mappings in ascending key order. So why this is happening in the first case?</p>

<p>Any suggestion is highly appreciated. </p>
