Skip to content

Commit

Permalink
feat: slice.Priority 优先级队列新增 Slice 函数,获取队列成员为切片类型
Browse files Browse the repository at this point in the history
  • Loading branch information
kercylan98 committed Sep 11, 2023
1 parent 4982e6d commit 30dbb14
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions utils/slice/priority.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ func (slf *Priority[V]) RangePriority(action func(index int, priority int) bool)
})
}

// Slice 返回切片
func (slf *Priority[V]) Slice() []V {
var vs []V
for _, item := range slf.items {
vs = append(vs, item.Value())
}
return vs
}

// String 返回切片字符串
func (slf *Priority[V]) String() string {
var vs []V
Expand Down

0 comments on commit 30dbb14

Please sign in to comment.