add iterator Key() function

This commit is contained in:
huangsimin 2020-03-04 11:47:13 +08:00
parent edd2e84792
commit adb2651169
4 changed files with 19 additions and 3 deletions

View File

@ -1,7 +1,7 @@
package pqueuekey
import (
"github.com/474420502/focus/stack/listarraystack"
lastack "github.com/474420502/focus/stack/listarraystack"
)
type Iterator struct {
@ -50,6 +50,10 @@ func (iter *Iterator) SetNode(n *Node) {
iter.tstack.Clear()
}
func (iter *Iterator) Key() interface{} {
return iter.cur.key
}
func (iter *Iterator) Value() interface{} {
return iter.cur.value
}

View File

@ -1,7 +1,7 @@
package avlkey
import (
"github.com/474420502/focus/stack/listarraystack"
lastack "github.com/474420502/focus/stack/listarraystack"
)
type Iterator struct {
@ -50,6 +50,10 @@ func (iter *Iterator) SetNode(n *Node) {
iter.tstack.Clear()
}
func (iter *Iterator) Key() interface{} {
return iter.cur.key
}
func (iter *Iterator) Value() interface{} {
return iter.cur.value
}

View File

@ -1,7 +1,7 @@
package avlkeydup
import (
"github.com/474420502/focus/stack/listarraystack"
lastack "github.com/474420502/focus/stack/listarraystack"
)
type Iterator struct {
@ -50,6 +50,10 @@ func (iter *Iterator) SetNode(n *Node) {
iter.tstack.Clear()
}
func (iter *Iterator) Key() interface{} {
return iter.cur.key
}
func (iter *Iterator) Value() interface{} {
return iter.cur.value
}

View File

@ -50,6 +50,10 @@ func (iter *Iterator) SetNode(n *Node) {
iter.tstack.Clear()
}
func (iter *Iterator) Key() interface{} {
return iter.cur.key
}
func (iter *Iterator) Value() interface{} {
return iter.cur.value
}