title: Java Hashmap ArrayList
body: <pre><code>import java.util.ArrayList;
  import java.util.Arrays;
  import java.util.HashMap;
  import java.util.List;
  import javax.swing.JOptionPane;
  
  
  public class HashMapDemo {
   public static double runProcess;
   public static int ID = 0;
   public static void processHashMap() {
    HashMap &lt; Integer, ArrayList &lt; String &gt;&gt; students = new HashMap &lt; &gt; ();
    List &lt; String &gt; arr = new ArrayList &lt;  &gt; (100);
    int x = 0;
    while (ID != -1) {
     String uData = JOptionPane.showInputDialog("Please enter your Student ID and Course Number (Seperated by a space) or enter -1 to view list: ");
     String[] splitter = uData.split(" ");
     ID = Integer.parseInt(splitter[0]);
     arr.add(0, splitter[1]);
     students.put(ID, (ArrayList &lt; String &gt; ) arr);
     x++;
    }
    System.out.println(Arrays.asList(students));
  
   }
   public static void main(String[] args) {
    processHashMap();
   }
  
  }
  </code></pre>
  
  <p>Output is: [{-1=[Test3, Test2, Test1, Test], 10=[Test3, Test2, Test1, Test], 11=[Test3, Test2, Test1, Test]}]</p>
  
  <p>I'm trying to get it to be designated to each ID, such that if someone enters ID "10 Test" "10 Test2" "100 Test3" only 10 will be 10=[Test2, Test] and 100=[Test3]</p>