23 lines
435 B
Plaintext
23 lines
435 B
Plaintext
import util.ordering
|
|
native scala.collection.mutable.PriorityQueue
|
|
|
|
data Task( priority, description )
|
|
|
|
def comparator( Task(a, _), Task(b, _) )
|
|
| a > b = -1
|
|
| a < b = 1
|
|
| otherwise = 0
|
|
|
|
q = PriorityQueue( ordering(comparator) )
|
|
|
|
q.enqueue(
|
|
Task(3, 'Clear drains'),
|
|
Task(4, 'Feed cat'),
|
|
Task(5, 'Make tea'),
|
|
Task(1, 'Solve RC tasks'),
|
|
Task(2, 'Tax return')
|
|
)
|
|
|
|
while not q.isEmpty()
|
|
println( q.dequeue() )
|