title: method invocation may produce nullpointerexception
body: <p>I'm trying to implement Graph using adjacency list, but when I try to add new pair into the list it gaves me an <code>NullPointerException</code>. Is there anyone know why it would happen and how to fix it?</p>
  
  <p>Thanks in advance.</p>
  
  <p>My <code>Graph.java</code> is like:</p>
  
  <pre><code>import javafx.util.Pair;
  import java.util.*;
  
  public class Graph{
      private final HashMap&lt;String, List&lt;Pair&lt;String, Integer&gt;&gt;&gt; adj;
  
      public Graph(String filePath) {
          adj = new HashMap&lt;&gt;();
          addEdge("a", "b", 30);
      }
  
      public void addEdge(String start, String end, int weight) {
          adj.get(start).add(new Pair&lt;&gt;(end, weight));
      }
  }
  </code></pre>
  
  <p>My <code>Main.java</code> is like:</p>
  
  <pre><code>public class Main {
      public static void main(String[] args) {
          Graph gr;
  
          try {
              gr = new Graph("test.txt");
          } catch (Exception ex) {
              ex.printStackTrace();
          }
      }
  }
  </code></pre>