title: Get the Strings that occur exactly three times from Arraylist<String>
body: <p>I have an <code>ArrayList</code> which contains some values with duplicates and elements that occur thrice, I want to collect those values that occur thrice specifically into another <code>ArrayList</code> like</p>
  
  <pre><code>Arraylist&lt;String&gt; strings;   //contains all strings that are duplicates and that occur thrice
  </code></pre>
  
  <p>Here, I want to get only the Strings that occur thrice in another array list.</p>
  
  <pre><code>Arraylist&lt;String&gt; thrice;    //contains only elements that occur three times.
  </code></pre>
  
  <p>Currently, I  have a <a href="https://stackoverflow.com/questions/54007206/get-the-duplicates-values-from-arrayliststring-and-then-get-those-items-in-ano">solution</a> for dealing with duplicates but I cannot extend this for only getting strings that occur thrice, this please help me to find out.</p>