PriorityQueue
does not override the method addAll
inherited from AbstractQueue
.
In AbstractQueue
this method looks like this.
public boolean addAll(Collection<? extends E> c) {
if (c == null)
throw new NullPointerException();
if (c == this)
throw new IllegalArgumentException();
boolean modified = false;
for (E e : c)
if (add(e))
modified = true;
return modified;
}
As you can see, it just loops and calls add
.
So I don't think addAll
will improve anything compared to add
.