title: How to avoid duplicate elements in Android ArrayObjectAdapter
body: <p>I'm adding elements to an <code>Android (Kotlin)</code> adapter extending <code>ArrayObjectAdapter</code>.
  I use addAll to add items.</p>
  
  <p>From ArrayObjectAdapter:</p>
  
  <pre><code>public void addAll(int index, Collection items) {
      int itemsCount = items.size();
      if (itemsCount == 0) {
          return;
      }
      mItems.addAll(index, items);
      notifyItemRangeInserted(index, itemsCount);
  }
  </code></pre>
  
  <p>My question is, how do I avoid duplicate elements in the adapter. The problem is, backing data collection for <code>ArrayObjectAdapter</code> is a List (not a Set) and when I use <code>addAll</code> it is possible to add a duplicate element. I can use <code>addAll</code> with the <code>LinkedHashSet</code> (as it takes a Collection as an input) but if I add another <code>hashset</code> it might have duplicates with the 1st <code>hashset</code> so I still need to check the whole list. I can of course go through all the list elements every time I add something but this is not a good solution for obvious reasons. Is there an efficient way to prevent duplicates in this scenario? Thanks. </p>