iterable

package
v1.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2022 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToMap

func ToMap[K comparable, V any](i Iterable[K, V]) map[K]V

func ToSlice

func ToSlice[V any](i Iterable[int, V]) []V

Types

type Generator

type Generator[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*Generator[K, V]) HasNext

func (g *Generator[K, V]) HasNext() bool

func (*Generator[K, V]) Next

func (g *Generator[K, V]) Next() (key K, value V, exist bool)

func (*Generator[K, V]) Reset

func (g *Generator[K, V]) Reset()

type Iterable

type Iterable[K comparable, V any] interface {
	Next() (K, V, bool)
	HasNext() bool
	Reset()
}

func FromMap

func FromMap[K comparable, V any](inner map[K]V) Iterable[K, V]

func FromMapWithKeyList

func FromMapWithKeyList[K comparable, V any](inner map[K]V, keys []K) Iterable[K, V]

func FromSlice

func FromSlice[V any](inner []V) Iterable[int, V]

func Map

func Map[K, NK comparable, V, NV any](i Iterable[K, V], fn func(K, V) (NK, NV)) Iterable[NK, NV]

func NewGenerator

func NewGenerator[K comparable, V any](key K, value V, inner func(K, V) (K, V)) Iterable[K, V]

type Slice

type Slice[V any] struct {
	// contains filtered or unexported fields
}

func (*Slice[V]) HasNext

func (s *Slice[V]) HasNext() bool

func (*Slice[V]) Next

func (s *Slice[V]) Next() (key int, value V, exist bool)

func (*Slice[V]) Reset

func (s *Slice[V]) Reset()

type Table

type Table[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func (*Table[K, V]) HasNext

func (m *Table[K, V]) HasNext() bool

func (*Table[K, V]) Next

func (m *Table[K, V]) Next() (key K, value V, exist bool)

func (*Table[K, V]) Reset

func (m *Table[K, V]) Reset()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL