Seems they both let you retrieve the minimum, which is what I need for Prim\'s algorithm, and force me to remove and reinsert a key to update its value. Is there any advanta
Rule of thumb about it is:
TreeMap maintains all elements orderly. (So intuitively, it takes time to construct it)
PriorityQueue only guarantees min or max. It's less expensive but less powerful.