You can install the package as below:
go get github.com/gozeloglu/iteratorFirstly, you need to create an iter object with New function. You can pass elements to that function.
it := iterator.New(1,2,3,4)Then, you can call the methods by using it object.
package main
import "github.com/gozeloglu/iterator"
func main() {
it := iterator.New(1,2,3,4)
it.Next() // Check whether there is element in next
it.Value() // Retrieve next element if exists
it.Prev() // Check whether there is element in prev
it.ToSlice() // Retrieve all elements in slice
it.First() // Updates the cursor by moving first index
it.Last() // Updates the cursor by moving last index
}You can run the test with following command.
go test
go test -v # verbose outputYou can also get code coverage with the following command.
go test -cover
go test -cover -v # verbose output