title: Saving data into hash-map using a jButton
body: <p>I'm new to java and need help in saving data into a hash-map via a jButton. I have a GUI which I created in netbeans and has three fields. <strong>Convenor ID, Examiner and Student ID</strong>. The user would simply enter data in each field and click Submit, which should store it into a hash-map. The issue I'm having is I want each record to be unique and have a key starting with G, which is incremented each time a record is submitted. 
  E.g <strong>G1 | 1 | KK | thr, tut, tet</strong> : <strong>G2 | 2 | KR | abc, def, ghi</strong> : etc.</p>
  
  <pre><code>private void savemode () {
       HashMap&lt;String, Collection&lt;String&gt;&gt; a = new HashMap&lt;String, Collection&lt;String&gt;&gt;();
       int x = Integer.parseInt(counter.getText());
       counter.getText();
  String key = "G" + x;
  String[] lines = textbox1.getText().split("\n"); 
  a.put(key, new ArrayList&lt;String&gt;());
  a.get(key).add(textbox2.getText());
  a.get(key).add(textbox3.getText());
  a.get(key).add(Arrays.toString(lines)); 
  
  textbox1.setText("");
  textbox2.setText("");
  textbox3.setText("");
  x++;
  counter.setText(Integer.toString(x));
  }
  </code></pre>