collections

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: MPL-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 Set

type Set[T comparable] map[T]struct{}

Set is a container that can hold each item only once and has a fast lookup time.

You can define a new set like this:

var validKeyLengths = collections.Set[int]{
    16: {},
    24: {},
    32: {},
}

You can also use the constructor to create a new set

var validKeyLengths = collections.NewSet[int](16,24,32)

func NewSet

func NewSet[T comparable](members ...T) Set[T]

Constructs a new set given the members of type T

func (Set[T]) Has

func (s Set[T]) Has(value T) bool

Has returns true if the item exists in the Set

func (Set[T]) String

func (s Set[T]) String() string

String creates a comma-separated list of all values in the set.

Jump to

Keyboard shortcuts

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