title: How to group by objects in java using collections?
body: <p>I'm very new to Java and I am trying to group by objects based on the number but I'm unable to make it. Here is the example:</p>
  
  <pre><code>SomeCollection&lt;Integer,String&gt; t=new SomeCollection&lt;Integer,String&gt;();
  t.put("1","a");
  t.put("1","b");
  t.put("2","c");
  
  output:
  1 - a,b
  2 - c
  </code></pre>
  
  <p>Basically, when numbers are same then value needs to be grouped under that same number. It's all about asking how to perform this kind of strategical output to achieve by using any collections. Any help is appreciated.</p>