title: Preventing AutoCompleteTextView from showing duplicates
body: <p>Take a look at my code below:</p>
  
  <pre><code>DatabaseReference database = FirebaseDatabase.getInstance().getReference();
  final ArrayAdapter&lt;String&gt; autoComplete = new ArrayAdapter&lt;&gt;(this, android.R.layout.simple_list_item_1);
  final HashSet&lt;String&gt; hashSet = new HashSet&lt;&gt;();
        //*I cut out the part where I get the data from the database and store it into "hashSet"
  autoComplete.addAll(hashSet);
  actv.setAdapter(autoComplete);
  </code></pre>
  
  <p>I tried this approach to prevent duplicate items in my ACTV(<code>AutoCompleteTextView</code>). However, suggestions no longer appear. It <strong>did</strong> work when I <strong>didn't</strong> first add the retrieved data and store it in <code>hashSet</code> and then add it to <code>autoComplete</code> but instead directly adding it to <code>autoComplete</code>.</p>
  
  <p>How can I solve this?</p>
  
  <hr>
  
  <p><strong>Edit:</strong> I've noticed something, in the method where I'm retrireving my data...</p>
  
  <pre><code> hashSet = new HashSet&lt;&gt;();
          database.child("AutoCompleteOptions").addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(DataSnapshot dataSnapshot) {
                  for (DataSnapshot suggestionSnapshot : dataSnapshot.getChildren()) {
                      String suggestion = suggestionSnapshot.child("suggestion").getValue(String.class);
                          //Log.d("FBSA",suggestion);
                          hashSet.add(suggestion);
                          for(String s:hashSet)
                              Log.d("FBSA",s);
                  }
              }
  </code></pre>
  
  <p>...my <code>HashSet</code> gets filled with items. However, when the program EXITS that method, it seems that my <code>HashSet</code> is completely CLEARED. What I mean is, in the <code>onDataChange()</code> method, when I add:</p>
  
  <pre><code>for(String s:hashSet)
     Log.d(TAG,s)
  </code></pre>
  
  <p>I get the list of items normally as I expected. <strong>However</strong>, when I do the for loop OUTSIDE <code>onDataChange()</code>, the HashSet is empty, meaning it was cleared. <strong>However, <em>this is not the same when using <code>ArrayAdapter</code></em></strong></p>