PriorityQueue
Martijn Verburg
martijnverburg at gmail.com
Thu May 14 18:11:14 UTC 2015
Hi Brett,
You can ask over at adoption-discuss about process, build etc. It is the
case at times where doing the work to produce a patch is just a starting
point for a discussion (it can be easier to discuss concrete code rather
than abstract ideas). One of the key things would be to have one of the
core committers of jdk9 and/or core-libs respond on this thread as well
(see jdk9 & core-libs membership at http://openjdk.java.net/census#members).
Also I'd search the archives for any previous discussions on this topic
(possibly under core-libs as well).
Cheers,
Martijn
On 14 May 2015 at 17:49, Brett Bernstein <brett.bernstein at gmail.com> wrote:
> Thank you for the encouragement. I wanted to make sure I wasn't missing
> something silly before learning how the submission process works, how to
> build the JDK on my machine, signed agreements, etc. I will hopefully be
> able to start down that road soon assuming my schedule accomodates.
>
> -Brett
>
> On Thu, May 14, 2015 at 12:01 PM, Ben Evans <benjamin.john.evans at gmail.com
> >
> wrote:
>
> > That sounds entirely plausible & will be of interest.
> >
> > Do you have a patch the community can review & contribute to?
> >
> > Thanks,
> >
> > Ben
> >
> >
> > On Fri, May 15, 2015 at 12:52 AM, Brett Bernstein
> > <brett.bernstein at gmail.com> wrote:
> > > My motivation is essentially what you stated. If someone needs to
> make a
> > > heap and their data is Comparable, the corresponding constructor gives
> a
> > > O(n) runtime. If their data uses a Comparator, the corresponding
> runtime
> > > (using addAll) is O(n*log(n)). It is true they will need to copy the
> > data
> > > into an array to use it (as initElementsFromCollection does), but that
> is
> > > unavoidable.
> > >
> > > On Thu, May 14, 2015 at 11:35 AM, Vitaly Davidovich <vitalyd at gmail.com
> >
> > > wrote:
> > >
> > >> What I mean is what could the PQ do more efficiently with your
> > Collection
> > >> vs you manually add()'ing each method? Are you looking to exploit the
> > same
> > >> behavior in its PriorityQueue(Collection), i.e. add and then heapify
> in
> > >> bulk? initElementsFromCollection() doesn't seem all that efficient in
> > the
> > >> first place if one were to invoke this on fast paths.
> > >>
> > >> On Thu, May 14, 2015 at 11:27 AM, Brett Bernstein <
> > >> brett.bernstein at gmail.com> wrote:
> > >>
> > >>> I may not understand what static method you are suggesting. If you
> > have
> > >>> a collection containing data and you wish to make it into a
> > PriorityQueue
> > >>> using a Comparator, there is no efficient method at the moment
> (addAll
> > >>> doesn't work).
> > >>>
> > >>>
> > >>> On Thu, May 14, 2015 at 10:11 AM, Vitaly Davidovich <
> vitalyd at gmail.com
> > >
> > >>> wrote:
> > >>>
> > >>>> What would be the intrinsic advantage of such a constructor? Why
> not a
> > >>>> simple static util method in your own code that emulates this?
> > >>>>
> > >>>> sent from my phone
> > >>>> On May 14, 2015 1:17 AM, "Brett Bernstein" <
> brett.bernstein at gmail.com
> > >
> > >>>> wrote:
> > >>>>
> > >>>>> To whom this may concern:
> > >>>>> I believe the list of PriorityQueue constructors has a glaring
> > omission
> > >>>>> that could be easily rectified. That is, there is no constructor
> > that
> > >>>>> takes a Collection and a Comparator. What steps should I go
> through
> > to
> > >>>>> get
> > >>>>> this suggested to be added to the class?
> > >>>>>
> > >>>>> Thanks,
> > >>>>> Brett Bernstein
> > >>>>>
> > >>>>
> > >>>
> > >>
> >
>
More information about the jdk9-dev
mailing list