set

package
v0.0.0-...-42d93e8 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashSet

type HashSet[E comparable] map[E]struct{}

func NewHashSet

func NewHashSet[E comparable]() HashSet[E]

func NewHashSetFromCollection

func NewHashSetFromCollection[E comparable](s collection.Collection[E]) HashSet[E]

func NewHashSetFromSlice

func NewHashSetFromSlice[E comparable](slice []E) HashSet[E]

func NewHashSetFromStream

func NewHashSetFromStream[E comparable](stream stream.Stream) HashSet[E]

func NewHashSetWithSize

func NewHashSetWithSize[E comparable](size int) HashSet[E]

func (HashSet[E]) Add

func (h HashSet[E]) Add(e E) bool

func (HashSet[E]) AddAll

func (h HashSet[E]) AddAll(other collection.Collection[E]) bool

func (HashSet[E]) AsSlice

func (h HashSet[E]) AsSlice() []E

func (HashSet[E]) Clear

func (h HashSet[E]) Clear()

func (HashSet[E]) Contains

func (h HashSet[E]) Contains(e E) bool

func (HashSet[E]) ContainsAll

func (h HashSet[E]) ContainsAll(other collection.Collection[E]) bool

func (HashSet[E]) ForEach

func (h HashSet[E]) ForEach(consumer func(e E))

func (HashSet[E]) ForEachIndexed

func (h HashSet[E]) ForEachIndexed(consumer func(index int, e E) (stop bool))

func (HashSet[E]) IsEmpty

func (h HashSet[E]) IsEmpty() bool

func (HashSet[E]) MarshalJSON

func (h HashSet[E]) MarshalJSON() ([]byte, error)

func (HashSet[E]) Remove

func (h HashSet[E]) Remove(e E) (found bool)

func (HashSet[E]) RemoveAll

func (h HashSet[E]) RemoveAll(other collection.Collection[E]) bool

func (HashSet[E]) RemoveIf

func (h HashSet[E]) RemoveIf(predicate func(e E) bool)

func (HashSet[E]) RetainAll

func (h HashSet[E]) RetainAll(other collection.Collection[E])

func (HashSet[E]) Size

func (h HashSet[E]) Size() int

func (HashSet[E]) Stream

func (h HashSet[E]) Stream() stream.Stream

func (HashSet[E]) String

func (h HashSet[E]) String() string

func (HashSet[E]) UnmarshalJSON

func (h HashSet[E]) UnmarshalJSON(bytes []byte) error

type LinkedHashSet

type LinkedHashSet[E comparable] struct {
	// contains filtered or unexported fields
}

func NewLinkedHashSet

func NewLinkedHashSet[E comparable]() LinkedHashSet[E]

func NewLinkedHashSetFromCollection

func NewLinkedHashSetFromCollection[E comparable](c collection.Collection[E]) LinkedHashSet[E]

func NewLinkedHashSetFromSlice

func NewLinkedHashSetFromSlice[E comparable](slice []E) LinkedHashSet[E]

func NewLinkedHashSetFromStream

func NewLinkedHashSetFromStream[E comparable](stream stream.Stream) LinkedHashSet[E]

func NewLinkedHashSetWithSize

func NewLinkedHashSetWithSize[E comparable](size int) LinkedHashSet[E]

func (*LinkedHashSet[E]) Add

func (lhs *LinkedHashSet[E]) Add(e E) bool

func (*LinkedHashSet[E]) AddAll

func (lhs *LinkedHashSet[E]) AddAll(other collection.Collection[E]) bool

func (*LinkedHashSet[E]) AsSlice

func (lhs *LinkedHashSet[E]) AsSlice() []E

func (*LinkedHashSet[E]) Clear

func (lhs *LinkedHashSet[E]) Clear()

func (*LinkedHashSet[E]) Contains

func (lhs *LinkedHashSet[E]) Contains(e E) bool

func (*LinkedHashSet[E]) ContainsAll

func (lhs *LinkedHashSet[E]) ContainsAll(other collection.Collection[E]) bool

func (*LinkedHashSet[E]) ForEach

func (lhs *LinkedHashSet[E]) ForEach(consumer func(e E))

func (*LinkedHashSet[E]) ForEachIndexed

func (lhs *LinkedHashSet[E]) ForEachIndexed(consumer func(index int, e E) (stop bool))

func (*LinkedHashSet[E]) IsEmpty

func (lhs *LinkedHashSet[E]) IsEmpty() bool

func (*LinkedHashSet[E]) MarshalJSON

func (lhs *LinkedHashSet[E]) MarshalJSON() ([]byte, error)

func (*LinkedHashSet[E]) Remove

func (lhs *LinkedHashSet[E]) Remove(e E) (found bool)

func (*LinkedHashSet[E]) RemoveAll

func (lhs *LinkedHashSet[E]) RemoveAll(other collection.Collection[E]) bool

func (*LinkedHashSet[E]) RemoveIf

func (lhs *LinkedHashSet[E]) RemoveIf(predicate func(e E) bool)

func (*LinkedHashSet[E]) RetainAll

func (lhs *LinkedHashSet[E]) RetainAll(other collection.Collection[E])

func (*LinkedHashSet[E]) Size

func (lhs *LinkedHashSet[E]) Size() int

func (*LinkedHashSet[E]) Stream

func (lhs *LinkedHashSet[E]) Stream() stream.Stream

func (*LinkedHashSet[E]) String

func (lhs *LinkedHashSet[E]) String() string

func (*LinkedHashSet[E]) UnmarshalJSON

func (lhs *LinkedHashSet[E]) UnmarshalJSON(bytes []byte) error

type Set

type Set[E comparable] interface {
	collection.Collection[E]
	// Add adds an element to the set.
	Add(e E) bool
	// AddAll adds all elements from the set to the set.
	AddAll(other collection.Collection[E]) bool
	// Remove removes an element from the set.
	Remove(e E) (found bool)
	// RemoveAll removes all elements from the set.
	RemoveAll(other collection.Collection[E]) bool
	// RemoveIf removes all elements that satisfy the predicate.
	RemoveIf(predicate func(e E) bool)
	// RetainAll retains only the elements in the set that are contained in the specified set.
	RetainAll(other collection.Collection[E])
	// Clear removes all elements from the set.
	Clear()
	// Contains returns true if the set contains the element.
	Contains(e E) bool
	// ContainsAll returns true if the set contains all elements in the specified set.
	ContainsAll(other collection.Collection[E]) bool
	// IsEmpty returns true if the set is empty.
	IsEmpty() bool
	// Size returns the number of elements in the set.
	Size() int
	// ForEach iterates over all elements in the set.
	ForEach(consumer func(e E))
	// ForEachIndexed iterates over all elements in the set.
	// The consumer function returns true to stop iterating.
	ForEachIndexed(consumer func(index int, e E) (stop bool))
	// AsSlice returns the set as a slice.
	AsSlice() []E
	// Stream returns a stream of the elements in the set.
	Stream() stream.Stream
}

Jump to

Keyboard shortcuts

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