Does PriorityQueue heapify itself if any object in the collection is mutated so that it's key(used in comparator) changes?

会有一股神秘感。 提交于 2019-12-02 00:49:30

The queue automatically heapifies on operations that mutates the queue itself, namely offer, poll, remove and add.

If you mutate an element you have to remove and re-insert it. The priority queue has no way of knowing that an element has been updated.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!