title: Populating a Hashmap in Java
body: <p>Ok I am having quite a bit of an issue. I want to populate my hash map with a set of String keywords. So basically, The user enters a keyword and if it matches the keyword in the hash map a parseFile method is called. Else if the user input is a synonym  of the keyword, I search the hash map for the original keyword. But my issue is populating the hash map. Can anyone guide me in the right direction? </p>
  
  <pre><code> public static void main(String[] args) throws FileNotFoundException {
  
      /* your synonym map of keywords and you have to populate 
      it before the user can give values.*/ 
      HashMap&lt;String, String[]&gt; synonymMap = new HashMap&lt;String, String[]&gt;();
      populateSynonymMap(); //populate the map
  
  
      /*Get user response*/ 
      System.out.println("What would you like to know?");
      System.out.print("&gt; ");
      Scanner scanner = new Scanner(System.in);
      String input = scanner.nextLine().toLowerCase();
  
      /*first check if the input already is the original one*/
      if (synonymMap.containsKey(input)) {
          parseFile(input);
      } else {
          /*if not then search the synonymMap to get the original keyword*/
          for (Map.Entry&lt;String,String[]&gt; entry : synonymMap.entrySet()) {
  
              String[] value = entry.getValue();                
              if (Arrays.asList(value).contains(input)) {
                  parseFile(entry.getKey());
                  break;
              }
          }
      }
  
  }
  </code></pre>