title: Java PriorityQueue removal of arbitrary elements performance
body: <p>Say I have a java PriorityQueue (which java implements as a heap) that I iterate over to remove elements based on some criteria:</p>
  
  <pre><code>PriorityQueue q = new PriorityQueue();
  ...
  Iterator it = q.iterator();
  while(it.hasNext()){
      if( someCriterion(it.next()) )
          it.remove();
  }
  </code></pre>
  
  <p>How long does each remove() operation take? I'm not sure whether it's O(log(n)) or O(1).</p>