set

package
v0.0.3-alpha Latest Latest
Warning

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

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

Documentation

Overview

Package set implements a set data structure.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set[T any] struct {
	Data []T
}

Set is a set data structure of type T

func (*Set[T]) Index

func (m *Set[T]) Index(va T) int

Index returns the index of the value, -1 if not found.

func (*Set[T]) IndexOrAdd

func (m *Set[T]) IndexOrAdd(va T) (int, bool)

IndexOrAdd returns the existing or the new index of the value, it returns true if the value existed, false if new.

Jump to

Keyboard shortcuts

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