set

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 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 Set

type Set[T comparable] struct {
	// contains filtered or unexported fields
}

Set is an implementation of ISet using the builtin map type. Set is threadsafe.

func New

func New[T comparable](items ...T) *Set[T]

New is the constructor for sets. It will pull from a reuseable memory pool if it can. Takes a list of items to initialize the set with.

func (*Set[T]) Add

func (set *Set[T]) Add(items ...T)

Add will add the provided items to the set.

func (*Set[T]) All

func (set *Set[T]) All(items ...T) bool

All returns a bool indicating if all of the supplied items exist in the set.

func (*Set[T]) Clear

func (set *Set[T]) Clear()

Clear will remove all items from the set.

func (*Set[T]) Dispose

func (set *Set[T]) Dispose()

Dispose will add this set back into the pool.

func (*Set[T]) Exists

func (set *Set[T]) Exists(item T) bool

Exists returns a bool indicating if the given item exists in the set.

func (*Set[T]) Flatten

func (set *Set[T]) Flatten() []T

Flatten will return a list of the items in the set.

func (*Set[T]) Len

func (set *Set[T]) Len() int64

Len returns the number of items in the set.

func (*Set[T]) Remove

func (set *Set[T]) Remove(items ...T)

Remove will remove the given items from the set.

Jump to

Keyboard shortcuts

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