title: How to convert a HashMap of Objects into an ArrayList of Strings
body: <p>I have a <code>HashMap</code> like so:</p>
  
  <pre><code>Hashmap&lt;String, Object&gt; map = new Hashmap&lt;String, Object&gt;();
  map.put(1, {id_student:"1;2;3"});
  map.put(2, {id_student:"4;5"});
  </code></pre>
  
  <p>I want to get the values and put it in an <code>ArrayList</code> like:</p>
  
  <pre><code>array = [0] - 1
          [1] - 2
          [2] - 3
          [3] - 4
          [4] - 5
  </code></pre>
  
  <p>what I tried to do:</p>
  
  <pre><code>private Set&lt;String&gt; checked = new TreeSet&lt;String&gt;();
  
  String idsAlunos = "";
  for (Iterator&lt;Map.Entry&lt;String, GPSEscolas&gt;&gt; it = aMap.entrySet().iterator(); it.hasNext(); ) {
      Map.Entry&lt;String, GPSEscolas&gt; entry = it.next();
  
      String id_escola = entry.getKey();
      String ids_aluno = entry.getValue().getAlunos();
  
      idsAlunos += ";" + ids_aluno;
  
      checked.add(idsAlunos.substring(1));
  }
  </code></pre>
  
  <p>but I'm getting this result from above code: <code>[4, 4;1;2;3, 4;5, 4;5;1;2;3]</code></p>