set

package
v0.6.0-rc.14 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHashSet

func NewHashSet() *hashset.Set

NewHashSet instantiates a new empty set of unordered elements

func NewTreeSetWith

func NewTreeSetWith(comp func(a, b interface{}) int) *treeset.Set

func NewTreeSetWithTimeComparator

func NewTreeSetWithTimeComparator() *treeset.Set

NewTreeSetWithTimeComparator instantiates a new empty set of ordered elements that contain time.Time

Types

type Comparator

type Comparator func(a, b interface{}) int

Comparator will make type assertion (see IntComparator for example), which will panic if a or b are not of the asserted type.

Should return a number:

negative , if a < b
zero     , if a == b
positive , if a > b

type Set

type Set interface {
	Add(items ...interface{})
	Remove(items ...interface{})
	Values() []interface{}
	String() string
	Clear()
	Size() int
	Empty() bool
	Contains(items ...interface{}) bool
}

Set is a data structure implementation of ordered or unordered collection of unique elements that should insert/delete in O(1) if unordered and insert/delete in O(logn) if ordered

Jump to

Keyboard shortcuts

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