PriorityQueue

Paul Sandoz paul.sandoz at oracle.com
Fri May 15 13:27:20 UTC 2015


On May 15, 2015, at 3:20 PM, Vitaly Davidovich <vitalyd at gmail.com> wrote:

> Paul,
> 
> I don't think you're missing anything obvious (unless I am as well :)).  What you wrote is basically what I meant by creating static helper method in Brett's own code that does exactly what you wrote.  The asymptotic complexity will be nlogn in both cases, but the constant factor will be different since addAll() makes iterative add() calls with some overhead (branches, modCount bump, etc).  The only O(n) constructors there are one taking SortedSet and copy constructor.
> 
> 

Yes.

> Brett did mention he wanted the bulk add functionality (i.e. remove constant factor), and given the class already supports that internally, seems like a harmless change.
> 
> 

I agree.

This seems like an ideal issue for someone to pick up who is interesting in contributing a patch+tests to OpenJDK. Brett, i gather you might be interested in doing so?

Paul.





More information about the core-libs-dev mailing list