set

package
v0.0.0-...-2847b59 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: MIT Imports: 0 Imported by: 3

Documentation

Overview

set is a Go library that implements a Set data structure

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emptier

type Emptier interface {
	// Removes all of the elements from a collection.
	// The collection will be empty after this call returns
	Empty()
}

Optional types

type HashSet

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

func New

func New() *HashSet

New instantiates a new empty set

func (*HashSet) Add

func (set *HashSet) Add(item interface{}) bool

Implements the Set.Add method

func (*HashSet) Empty

func (set *HashSet) Empty()

Implements the Clearer.Empty method

func (*HashSet) IsElementOf

func (set *HashSet) IsElementOf(item interface{}) bool

Implements the Set.IsElementOf method

func (*HashSet) Remove

func (set *HashSet) Remove(item interface{}) bool

Implements the Set.Remove method

func (*HashSet) Size

func (set *HashSet) Size() int

Implements the Set.Size method

func (*HashSet) Values

func (set *HashSet) Values() []interface{}

Values returns all items in the set as a slice

type Interface

type Interface interface {
	// Adds the specified element to the set and returns true if the operation was successful or false
	// or false if the element already exists
	Add(v interface{}) bool

	// Removes the specified element from this set if it is present
	Remove(v interface{}) bool

	// Checks weather the element exists in the Set
	IsElementOf(v interface{}) bool

	// Get the size of the Set
	Size() int
}

Package Set Interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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