hashset

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: ISC Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HashSet

type HashSet map[externalapi.DomainHash]struct{}

HashSet is an unsorted unique collection of DomainHashes

func New

func New() HashSet

New creates and returns an empty HashSet

func NewFromSlice

func NewFromSlice(hashes ...*externalapi.DomainHash) HashSet

NewFromSlice creates and returns a HashSet with contents according to provided slice

func (HashSet) Add

func (hs HashSet) Add(hash *externalapi.DomainHash)

Add appends a hash to this HashSet. If given hash already exists - does nothing

func (HashSet) Contains

func (hs HashSet) Contains(hash *externalapi.DomainHash) bool

Contains returns true if this HashSet contains the given hash.

func (HashSet) ContainsAllInSlice

func (hs HashSet) ContainsAllInSlice(slice []*externalapi.DomainHash) bool

ContainsAllInSlice returns true if this HashSet contains all hashes in given slice

func (HashSet) Length

func (hs HashSet) Length() int

Length returns the length of this HashSet

func (HashSet) Remove

func (hs HashSet) Remove(hash *externalapi.DomainHash)

Remove removes a hash from this HashSet. If given hash does not exist in HashSet - does nothing.

func (HashSet) String

func (hs HashSet) String() string

String returns a string representation of this hash set

func (HashSet) Subtract

func (hs HashSet) Subtract(other HashSet) HashSet

Subtract creates and returns a new HashSet that contains all hashes in this HashSet minus the ones in `other`

func (HashSet) ToSlice

func (hs HashSet) ToSlice() []*externalapi.DomainHash

ToSlice converts this HashSet into a slice of hashes

Jump to

Keyboard shortcuts

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