title: Check if an ArrayList contains the same element as another ArrayList
body: <p>I have used some other answers to get a solution to my problem. But I am wondering if there is a way to improve this further?</p>
  <pre><code>// Copy the masterList ArrayList and then sort in ascending order and then make a third 
  // ArrayList and loop through to add the 8 lowest values to this list.
  ArrayList&lt;Integer&gt; sortedList = new ArrayList&lt;&gt;(Calculator.masterList);
  Collections.sort(sortedList);
  ArrayList&lt;Integer&gt; lowEight = new ArrayList&lt;&gt;();
  for (int i = 0; i &lt; 8; i++) {
      lowEight.add(sortedList.get(i));
  }
  </code></pre>
  <pre><code>// Set TextView as the value of index 0 in masterList ArrayList, check if lowEight 
  // ArrayList contains the element that is the same as masterList index 0 and if
  // so highlight s1 textview green.
  s1.setText(&quot;Score 1 is &quot; + String.format(&quot;%d&quot;, Calculator.masterList.get(0)));
  if (lowEight.contains(Calculator.masterList.get(0))) {
      s1.setBackgroundColor(Color.GREEN);
  }
  </code></pre>
  <p>This works to an extent by highlighting the values that are in both <code>masterList</code> and <code>lowEight</code> but for example if the number 7 is in <code>lowEight</code> and appears 9 times in <code>masterList</code> it will highlight all 9 occurences. Is there a way to move the exact object from <code>masterList</code> to <code>sortedList</code> and then to <code>lowEight</code> and then a method to check the object and not just the value?</p>