title: Add unique items to recyclerView from geoQuery
body: <p>I created an app that shows items of users near me.</p>
  
  <p>I find the people who near me by using <code>geoQuery</code> and if they are near me, I search in the database what items they have and I populate a <code>RecyclerView</code> with them.</p>
  
  <p>I do so by using:</p>
  
  <pre><code>List&lt;DiscoverItems&gt; items = new ArrayList&lt;&gt;();
  
  GeoQuery geoQuery = geoFire.queryAtLocation(new GeoLocation(Lat, Lon), Radius);
  geoQuery.addGeoQueryEventListener(new GeoQueryEventListener() {
      @Override
      public void onKeyEntered(String key, GeoLocation location) {
  
          String UserID = key;
  
          if (!UserID.equals(auth.getUid())) {
              db.collection("Users").document(UserID).collection("MyItems").get().addOnCompleteListener(task_count -&gt; {
                  if (task_count.isSuccessful()) {
                      for (DocumentSnapshot document_near : task_count.getResult()) {
                          items.add(new DiscoverItems(document_near.getString("ItemID")));
                      }
  
                  }
              });
          }
  
          discoverItemAdapter = new DiscoverItemAdapter(items, listener);
          rv_NearMeItems.setAdapter(discoverItemAdapter);
  
      }
  
      @Override
      public void onKeyExited(String key) {
  
      }
  
      @Override
      public void onKeyMoved(String key, GeoLocation location) {
  
      }
  
      @Override
      public void onGeoQueryReady() {
  
      }
  
      @Override
      public void onGeoQueryError(DatabaseError error) {
  
      }
  });
  </code></pre>
  
  <p>However, my problem is if some users have the same item, because then it will appear twice in the recyclerView while I had liked it to have unique items.</p>
  
  <p>Is there any solution where I can first check my items list for duplicate and only then to add them?</p>
  
  <p>I tried to do the following:</p>
  
  <pre><code>List&lt;DiscoverItems&gt; items= new ArrayList&lt;&gt;();
  Set&lt;DiscoverItems&gt; itemkset = new HashSet&lt;&gt;();
  
  GeoQuery geoQuery = geoFire.queryAtLocation(new GeoLocation(Lat, Lon), Radius);
  geoQuery.addGeoQueryEventListener( new GeoQueryEventListener() {
      @Override
      public void onKeyEntered(String key, GeoLocation location) {
  
          String UserID = key;
  
          if (!UserID.equals( auth.getUid() )) {
              db.collection( "Users" ).document( UserID ).collection( "MyItems" ).get().addOnCompleteListener( task_count -&gt; {
                  if (task_count.isSuccessful()) {
                      for (DocumentSnapshot document_near : task_count.getResult()) {
                          itemset.add( new DiscoverItems( document_near.getString( "ItemID" ) ) );
                      }
                  }
              } );
          }
          List&lt;DiscoverItems&gt; itemsWithoutDuplicates = new ArrayList&lt;&gt;(new HashSet&lt;&gt;(itemset));
          for (DiscoverItems item: itemsWithoutDuplicates){
              items.add(item);
          }
      discoverItemAdapter = new DiscoverItemAdapter(items, listener);
      rv_NearMeItems.setAdapter(discoverItemAdapter);
      }
  </code></pre>
  
  <p>But it doesn't work since if for example, I have 2 users, <code>onKeyEntered</code> will be called twice. For the first user it will add to <code>itemset</code> let say 4 items which are not identical and everything will be ok. Then it will call the second user which will add also 3 items to itemset which are not identical and it will be ok.</p>
  
  <p>Am I missing something?
  Because with the code above I'm getting multiple items.</p>
  
  <p>Thank you</p>