title: reading CSV file into hashmap
body: <p>I have a CSV file which contain fields as follows:
  Field 1, Field 2,Field 3, the frequency , and I want to assign it to hash map variable in Java. the code below from <a href="http://www.philippe-fournier-viger.com/spmf/" rel="nofollow noreferrer">here</a> is to scan the file and calculate the frequency for each line, However I have the file with frequencies already so I just need to read a few lines. so I replace </p>
  
  <pre><code>    // split the transaction into items
  </code></pre>
  
  <p>with </p>
  
  <pre><code>        String[] lineSplited = line.split(" "); 
          String itemString = lineSplited[0];
          Integer count = Integer.valueOf(lineSplited[1]);
          mapSupport.put(itemString, count);
  </code></pre>
  
  <p>in the original code  </p>
  
  <pre><code>private void DetermineFrequencyOfSingleItems(String input,
              final Map&lt;String, Integer&gt; mapSupport)
              throws FileNotFoundException, IOException {
          //Create object for reading the input file
          BufferedReader reader = new BufferedReader(new FileReader(input));
          String line;
          // for each line (transaction) until the end of file
          while( ((line = reader.readLine())!= null)){ 
              // if the line is  a comment, is  empty or is a
              // kind of metadata
              if (line.isEmpty() == true ||
                      line.charAt(0) == '#' || line.charAt(0) == '%'
                              || line.charAt(0) == '@') {
                  continue;
              }
  
              // split the transaction into items
              String[] lineSplited = line.split(" ");
               // for each item in the transaction
              for(String itemString : lineSplited){ 
                  // increase the support count of the item
                  Integer count = mapSupport.get(itemString);
                  if(count == null){
                      mapSupport.put(itemString, 1);
                  }else{
                      mapSupport.put(itemString, ++count);
                  }
              }
              // increase the transaction count
              transactionCount++;
          }
          // close the input file
          reader.close();
      } 
  </code></pre>
  
  <p>but it does not work, any suggestion?</p>