title: Check if a string contains another string twice
body: <p>I have a for loop which iterates through a maplist and now I want to check every entry of the maplist if it contains a certain String more than once and then delete all Strings except the first one which occurs but I have no clue how to do it.</p>
  
  <pre class="lang-java prettyprint-override"><code>for (Map&lt;String, String&gt; entry : mapList) {
      String line = "";
      for (String key : entry.keySet()) {
          if (StringUtils.containsAny(key, "5799"){
              line += entry.get(key) + "|";
          }
          list1.add(line);
      }
  }
  </code></pre>
  
  <p>I am thankful for every idea.</p>