@@ -8,14 +8,14 @@ import (
88// PriorityQueue represents the queue
99type PriorityQueue struct {
1010 itemHeap * itemHeap
11- lookup map [interface {} ]* item
11+ lookup map [string ]* item
1212}
1313
1414// New initializes an empty priority queue.
1515func New () PriorityQueue {
1616 return PriorityQueue {
1717 itemHeap : & itemHeap {},
18- lookup : make (map [interface {} ]* item ),
18+ lookup : make (map [string ]* item ),
1919 }
2020}
2121
@@ -41,7 +41,7 @@ func (p *PriorityQueue) Insert(v interface{ Hash() string }, priority float64) {
4141
4242// Pop removes the element with the highest priority from the queue and returns it.
4343// In case of an empty queue, an error is returned.
44- func (p * PriorityQueue ) Pop () (interface {} , error ) {
44+ func (p * PriorityQueue ) Pop () (any , error ) {
4545 if len (* p .itemHeap ) == 0 {
4646 return nil , errors .New ("empty queue" )
4747 }
@@ -54,7 +54,7 @@ func (p *PriorityQueue) Pop() (interface{}, error) {
5454type itemHeap []* item
5555
5656type item struct {
57- value interface {}
57+ value any
5858 priority float64
5959 index int
6060}
@@ -73,13 +73,13 @@ func (ih *itemHeap) Swap(i, j int) {
7373 (* ih )[j ].index = j
7474}
7575
76- func (ih * itemHeap ) Push (x interface {} ) {
76+ func (ih * itemHeap ) Push (x any ) {
7777 it := x .(* item )
7878 it .index = len (* ih )
7979 * ih = append (* ih , it )
8080}
8181
82- func (ih * itemHeap ) Pop () interface {} {
82+ func (ih * itemHeap ) Pop () any {
8383 old := * ih
8484 item := old [len (old )- 1 ]
8585 * ih = old [0 : len (old )- 1 ]
0 commit comments