A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/danielgatis/go-iterator below:

danielgatis/go-iterator: This package provides an iterator interface and a slice iterator implementation

This package provides an iterator interface and a slice iterator implementation.

go get -u github.com/danielgatis/go-iterator

And then import the package in your code:

import "github.com/danielgatis/go-iterator"

An example described below is one of the use cases.

package main

import (
	"fmt"

	"github.com/danielgatis/go-iterator"
)

func main() {
	numbers := []int{1, 2, 3, 4, 5}
	iter := iterator.NewIterator(numbers)

	for iter.HasNext() {
		value := iter.GetNextOrDefault(0)
		fmt.Println(value)
	}
}

Copyright (c) 2023-present Daniel Gatis

Licensed under MIT License

Liked some of my work? Buy me a coffee (or more likely a beer)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4