title: remove consecutively occurring elements from arraylist
body: <p>e.g if <code>ArrayList</code> with <code>set1 = {"a", "a", "b", "a", "b", "c", "d", "e"}</code>,   <code>ArrayList</code> with <code>set2 = {"a", "b"}</code>.Then remove occurrence of <code>a</code> and <code>b</code> <code>set1</code> will have <code>{"c", "d", "e"}</code></p>
  
  <p>e.g if ArrayList with set1 = {"a", "a", "b", "a", "b", "c", "d", "e"}
         ArrayList with set2 = {"a", "b"}</p>
  
  <pre><code>   then remove occurence of a and b set1 will have {"c", "d", "e"}
  </code></pre>
  
  <p>I have tried:</p>
  
  <pre><code>public class test {
  public static void main(String[] args){
  ArrayList&lt;String&gt; contents = new ArrayList&lt;String&gt;();
  contents.add("a");
  contents.add("a");
  contents.add("b");
  contents.add("b");
  contents.add("c");
  contents.add("d");
  contents.add("e");
  
  ArrayList&lt;String&gt; delete = new ArrayList&lt;String&gt;();
  delete.add("a");
  delete.add("b");
  
  for(String str: contents)
  System.out.println(str);
  
  System.out.println();
  
  contains(contents, delete);
  
  System.out.println();
  
  for(String st: contents)
     System.out.println(st);
  
  }
  
  public static void contains(ArrayList&lt;String&gt; set1, ArrayList&lt;String&gt; set2 ) {
  
  int count = 0;
  
  OUTER:
  for (int i = 0; i &lt; set1.size() - set2.size(); i++) {
  for (int j = 0; j &lt; set2.size(); j++) {
  if (!set1.get(i + j).equals(set2.get(j)))
  continue OUTER;
  else{
  set1.remove(set1.get(i+j));                  
  }
  
  }
  count++;
  
  }        
  
  System.out.println(count);
  
  }
  </code></pre>
  
  <p>current Output: a
                  b
                  c
                  d
                  e
  I still get a b c d e but I should only should get c d e because since a,b occurs twice it should remove both occurences.</p>