sets

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: May 5, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package sets contains set data structures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SizeLimitedStringSet

type SizeLimitedStringSet struct {
	// contains filtered or unexported fields
}

A SizeLimitedStringSet is a StringSet which is limited to a given size. Once the capacity is reached an element will be removed at random.

func NewSizeLimitedStringSet

func NewSizeLimitedStringSet(capacity int) *SizeLimitedStringSet

NewSizeLimitedStringSet create a new SizeLimitedStringSet.

func (*SizeLimitedStringSet) Add

func (s *SizeLimitedStringSet) Add(element string)

Add adds an element to the set.

func (*SizeLimitedStringSet) ForEach

func (s *SizeLimitedStringSet) ForEach(callback func(element string) bool)

ForEach iterates over all the elements in the set.

type SortedString

type SortedString struct {
	// contains filtered or unexported fields
}

A SortedString is a set of strings with sorted iteration.

func NewSortedString

func NewSortedString() *SortedString

NewSortedString creates a new sorted string set.

func (*SortedString) Add

func (s *SortedString) Add(elements ...string)

Add adds a string to the set.

func (*SortedString) Clear

func (s *SortedString) Clear()

Clear clears the set.

func (*SortedString) Delete

func (s *SortedString) Delete(element string)

Delete deletes an element from the set.

func (*SortedString) ForEach

func (s *SortedString) ForEach(callback func(element string) bool)

ForEach iterates over the set in ascending order.

func (*SortedString) Has

func (s *SortedString) Has(element string) bool

Has returns true if the elment is in the set.

func (*SortedString) Size

func (s *SortedString) Size() int

Size returns the size of the set.

func (*SortedString) ToSlice

func (s *SortedString) ToSlice() []string

ToSlice returns a slice of all the elements in the set.

Jump to

Keyboard shortcuts

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