title: How do I correctly add a snapshot listener to a Firebase Firestore document reference in Java?
body: <p>I'm following the Java (Android) documentation to a tee for realtime updates however I'm getting error: <code>EventListener takes no type parameters</code>. </p>
  
  <p>I removed <code>&lt;DocumentSnapshot&gt;</code>  but that just caused further errors. </p>
  
  <p>Here is the code block from the documentation:</p>
  
  <pre><code>final DocumentReference docRef = db.collection("cities").document("SF");
  docRef.addSnapshotListener(new EventListener&lt;DocumentSnapshot&gt;() {
      @Override
      public void onEvent(@Nullable DocumentSnapshot snapshot,
                          @Nullable FirebaseFirestoreException e) {
          if (e != null) {
              Log.w(TAG, "Listen failed.", e);
              return;
          }
          if (snapshot != null &amp;&amp; snapshot.exists()) {
              Log.d(TAG, "Current data: " + snapshot.getData());
          } else {
              Log.d(TAG, "Current data: null");
          }
      }
  });
  </code></pre>
  
  <p>The above sample is identical to Google's published documentation. Here is the documentation I am following:
  <a href="https://firebase.google.com/docs/firestore/query-data/listen" rel="nofollow noreferrer">https://firebase.google.com/docs/firestore/query-data/listen</a></p>
  
  <p>Any idea what I'm doing wrong?</p>