Help us shape the future of Go! Take the 2026 Go Developer Survey

persistent

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2025 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OrderedSet

type OrderedSet[T comparable] struct {
	Parent *OrderedSet[T]
	// contains filtered or unexported fields
}

func NewOrderedSet

func NewOrderedSet[T comparable](parent *OrderedSet[T]) *OrderedSet[T]

NewOrderedSet returns a set with the given parent. To create an empty set, pass nil.

func (*OrderedSet[T]) Add

func (s *OrderedSet[T]) Add(item T)

Add inserts an item into the set.

func (*OrderedSet[T]) AddIntersection

func (s *OrderedSet[T]) AddIntersection(a, b *OrderedSet[T])

AddIntersection adds the members that exist in both given member sets.

func (*OrderedSet[T]) Clone

func (s *OrderedSet[T]) Clone() *OrderedSet[T]

Clone returns a new child set that contains all items of this parent set. Changes to the returned set will only be applied in the returned set, not the parent.

func (*OrderedSet[T]) Contains

func (s *OrderedSet[T]) Contains(item T) (present bool)

Contains returns true if the given item exists in the set.

func (*OrderedSet[T]) ForEach

func (s *OrderedSet[T]) ForEach(cb func(item T) error) error

ForEach calls the given function for each item. It can be used to iterate over all items of the set.

func (*OrderedSet[T]) IsEmpty

func (s *OrderedSet[T]) IsEmpty() bool

IsEmpty returns true if the set is empty, or false if it contains items.

Jump to

Keyboard shortcuts

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