example

package
v0.0.0-...-05962f3 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection interface {
	CreateIterator() Iterator
}

集合接口

type ConcreteCollection

type ConcreteCollection struct {
}

具体集合

func (*ConcreteCollection) CreateIterator

func (u *ConcreteCollection) CreateIterator() Iterator

初始化具体集合对象,用于创建具体迭代器对象

type ConcreteIterator

type ConcreteIterator struct {
	IterationState bool
}

具体迭代器

func (*ConcreteIterator) GetNext

func (i *ConcreteIterator) GetNext()

具体迭代器的方法,用于递增迭代器以指向下一个元素

func (*ConcreteIterator) HasMore

func (i *ConcreteIterator) HasMore() bool

具体迭代器的方法

type Iterator

type Iterator interface {
	// 返回是否存在另一个下一个元素
	HasMore() bool

	// 递增迭代器,用于指向下一个元素
	GetNext()
}

迭代器接口

Jump to

Keyboard shortcuts

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