set

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hashable

type Hashable interface {
	Hash() int
}

type Set

type Set[T any] interface {
	// Add adds an element to the set.
	Add(element T)
	// Clear removes all elements from the set.
	Clear()
	// Contains returns true if the set contains the given element.
	Contains(element T) bool
	// IsEmpty returns true if the set is empty.
	IsEmpty() bool
	// Remove removes the given element from the set.
	Remove(element T)
	// Size returns the number of elements in the set.
	Size() int
	ToSlice() []T
	Iterator() iterable.Iterator[T]
}

func NewConcurrentUnordered added in v0.3.0

func NewConcurrentUnordered[T Hashable]() Set[T]

func NewConcurrentUnorderedSize added in v0.3.0

func NewConcurrentUnorderedSize[T Hashable](size int) Set[T]

func NewUnordered

func NewUnordered[T Hashable]() Set[T]

Creates a new unordered set that implements the Set[T] interface.

func NewUnorderedSize

func NewUnorderedSize[T Hashable](size int) Set[T]

Creates a new unordered set with an expected size, that implements the Set[T] interface.

Jump to

Keyboard shortcuts

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