public boolean relaxPriority ( E key , double priority ) { Entry < E > entry = getEntry ( key ) ; if ( entry == null ) { entry = makeEntry ( key ) ; } if ( compare ( priority , entry . priority ) <= 0 ) { return false ; } entry . priority = priority ; heapifyUp ( entry ) ; return true ; }
Promotes a key in the queue adding it if it wasn t there already . If the specified priority is worse than the current priority nothing happens . Faster than add if you don t care about whether the key is new .