title: Implementing a Map to count character frequency
body: <p>Basically I'm trying to implement a map using a String as the key (single character) and an integer variable (character frequency). </p>
  
  <p>I get inaccurate frequencies when the program runs.
  Does anyone see where I'm going wrong?</p>
  
  <pre><code>import java.io.File;
  import java.io.FileNotFoundException;
  import java.util.HashMap;
  import java.util.Map;
  import java.util.Scanner;
  
  
  public class WordCount {
  
      public static void main(String[] args) throws FileNotFoundException{
          File f1 = new File("article.txt");
          Scanner scan = new Scanner(f1).useDelimiter("|");
  
          Map&lt;String, Integer&gt; wordMap = new HashMap&lt;String, Integer&gt;();
          String letter;
          Integer value = 0;
  
          while(scan.hasNext()){
  
              letter = scan.next();
  
              if(wordMap.containsKey(letter)) wordMap.put(letter, value++);
  
              else wordMap.put(letter, new Integer(value++));
          }
          System.out.println(wordMap);
  
  
      }
  
  }
  </code></pre>