title: what is the difference between these two object initialization in java?
body: <p>If i use:</p>
  
  <pre><code>    HashMap&lt;String, Integer&gt; test = new HashMap&lt;String, Integer&gt;();
  </code></pre>
  
  <p>Or i use:</p>
  
  <pre><code>    HashMap test = new HashMap();
  </code></pre>
  
  <p>Is there any difference on further methods that i can apply on test object. like test.put(), test.get() etc if initialized differently??</p>
  
  <p>Also if i put something in test object e.g like:</p>
  
  <pre><code>    test.put("One", new Integer(5));
      test.put("Two", new Integer(4));
      test.put("Three", new Integer(3));
  </code></pre>
  
  <p>and display it as:</p>
  
  <p>Set set = tokens.entrySet();<br>
          Iterator ik = test.iterator();</p>
  
  <pre><code>    while(ik.hasNext()){
        Map.Entry me = (Map.Entry)ik.next();
        System.out.println(me.getKey() + " : " + me.getValue() );
  </code></pre>
  
  <p>The result is not sorted, restul is:</p>
  
  <p>Three: 3
  One: 5
  Two: 1</p>
  
  <p>What rule it does follow?? Is this normal behavior for the output to be randomly displayed??</p>