title: Using array as key for hashmap java
body: <p>i have a method that puts some value(obtained from an excel file) into a hashmap with an array as the key</p>
  
  <pre><code>public HashMap&lt;List&lt;String&gt;, List&lt;String[]&gt;&gt; sbsBusServiceDataGnr() throws 
      IOException
  {
      System.out.println(engine.txtY + "Processing HashMap "
          + "sbsBusServiceData..." + engine.txtN);
      int counterPass = 0, counterFail = 0, stopCounter = 0;
      String dataExtract, x = "";
      String[] stopInfo = new String[3];
      List&lt;String[]&gt; stopsData = new ArrayList&lt;String[]&gt;();
      List&lt;String&gt; serviceNum = new Vector&lt;String&gt;();
  
      HashMap&lt;List&lt;String&gt;, List&lt;String[]&gt;&gt; sbsBusServiceData = 
          new HashMap&lt;List&lt;String&gt;, List&lt;String[]&gt;&gt;();
      String dataPath = this.dynamicPathFinder(
          "Data\\SBS_Bus_Routes.csv");
      BufferedReader sbsBusServiceDataPop = new BufferedReader(
          new FileReader(dataPath));
  
      sbsBusServiceDataPop.readLine();
      //Skips first line
      while ((dataExtract = sbsBusServiceDataPop.readLine()) != null) {
          try {
              String[] dataParts = dataExtract.split(",", 5);
              if (!dataParts[4].equals("-")){
                  if (Double.parseDouble(dataParts[4]) == 0.0){
                      sbsBusServiceData.put(serviceNum, stopsData);
                      String serviceNum1 = "null", serviceNum2 = "null";
                      if(!serviceNum.isEmpty()){
                          serviceNum1 = serviceNum.get(0);
                          serviceNum2 = serviceNum.get(1);
                      }
                      System.out.println("Service Number " + serviceNum1 
                          + ":" + serviceNum2 + " with " + stopCounter 
                          + " stops added.");
                      stopCounter = 0;
                      //Finalizing previous service
  
                      serviceNum.Clear();
                      serviceNum.add(0, dataParts[0]);
                      serviceNum.add(1, dataParts[1]);
                      //Adding new service
                  }
              }
              stopInfo[0] = dataParts[2];
              stopInfo[1] = dataParts[3];
              stopInfo[2] = dataParts[4];
              stopsData.add(stopInfo);
              //Adding stop to service
  
              stopCounter++;
              counterPass++;
              }
          catch (Exception e) {
              System.out.println(engine.txtR + "Unable to process "
                  + dataExtract + " into HashMap sbsBusServiceData." 
                  + engine.txtN + e);
              counterFail++;
          }
      }
      sbsBusServiceDataPop.close();
  
      System.out.println(engine.txtG + counterPass + " number of lines"
          + " processed into HashMap sbsBusServiceData.\n" + engine.txtR
          + counterFail + " number of lines failed to process into "
          + "HashMap sbsBusServiceData.");
  
      return sbsBusServiceData;
  }
  //Generates sbsBusServiceDataGnr HashMap : 15376 Data Rows
  //HashMap Contents: {ServiceNumber, Direction}, 
  //    &lt;{RouteSequence, bsCode, Distance}&gt;
  </code></pre>
  
  <p>this method work for putting the values into the hashmap but i cannot seem to get any value from the hashmap when i try to call it there is always a nullpointerexception</p>
  
  <pre><code>List&lt;String&gt; sbsTest = new Vector&lt;String&gt;();
      sbsTest.add(0, "10");
      sbsTest.add(1, "1");
      System.out.println(sbsBusServiceData.get(sbsTest));
      try{
          List&lt;String[]&gt; sbsServiceResults = sbsBusServiceData.get(sbsTest);
          System.out.println(sbsServiceResults.size());
          String x = sbsServiceResults.get(1)[0];
          System.out.println(x);
      } catch(Exception e){
          System.out.println(txtR + "No data returned" + txtN + e);
      }
  </code></pre>
  
  <p>this is a sample of the file im reading the data from:</p>
  
  <p><a href="https://docs.google.com/document/d/1z1uF-lp_KfVTX950upSBgkxOaEUr0RUMW7--aDbsyMo/edit?usp=sharing" rel="nofollow noreferrer">SBS</a></p>
  
  <p>How can i get the hashmap to return me the value i want?</p>