# NOT RUN {
q <- PriorityQueue$new()
q$push("not_urgent")
q$push("urgent", priority = 2)
q$push("not_as_urgent", priority = 1)
q$pop() # urgent
q$pop() # not_as_urgent
q$pop() # not_urgent
q <- PriorityQueue$new(list("not_urgent", "urgent"), c(0, 2))
q$push("not_as_urgent", 1)$push("not_urgent2")
# }
Run the code above in your browser using DataLab