class Concurrent::Collection::RubyNonConcurrentPriorityQueue

def sink(k)

Parameters:
  • k (Integer) -- the index at which to start the percolation
def sink(k)
  success = false
  while (j = (2 * k)) <= @length do
    j += 1 if j < @length && ! ordered?(j, j+1)
    break if ordered?(k, j)
    swap(k, j)
    success = true
    k = j
  end
  success
end