Simplify Nexter interface
This change allows a Nexter to be used in the same manner as a scanner
using a for graph.Next(it) {} construction.
It is important that graph.Next(it) and any associated it.Result() calls
operate on the same iterator.
This commit is contained in:
parent
f8e28e066e
commit
b1a70d99aa
31 changed files with 168 additions and 233 deletions
|
|
@ -23,12 +23,8 @@ import (
|
|||
|
||||
func iterated(it graph.Iterator) []int {
|
||||
var res []int
|
||||
for {
|
||||
val, ok := graph.Next(it)
|
||||
if !ok {
|
||||
break
|
||||
}
|
||||
res = append(res, val.(int))
|
||||
for graph.Next(it) {
|
||||
res = append(res, it.Result().(int))
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue