gods: github.com/emirpasic/gods/sets/hashset Index | Files

package hashset

import "github.com/emirpasic/gods/sets/hashset"

Package hashset implements a set backed by a hash table.

Structure is not thread safe.

References: http://en.wikipedia.org/wiki/Set_%28abstract_data_type%29

Index

Package Files

hashset.go serialization.go

type Set Uses

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

Set holds elements in go's native map

func New Uses

func New(values ...interface{}) *Set

New instantiates a new empty set and adds the passed values, if any, to the set

func (*Set) Add Uses

func (set *Set) Add(items ...interface{})

Add adds the items (one or more) to the set.

func (*Set) Clear Uses

func (set *Set) Clear()

Clear clears all values in the set.

func (*Set) Contains Uses

func (set *Set) Contains(items ...interface{}) bool

Contains check if items (one or more) are present in the set. All items have to be present in the set for the method to return true. Returns true if no arguments are passed at all, i.e. set is always superset of empty set.

func (*Set) Empty Uses

func (set *Set) Empty() bool

Empty returns true if set does not contain any elements.

func (*Set) FromJSON Uses

func (set *Set) FromJSON(data []byte) error

FromJSON populates the set from the input JSON representation.

func (*Set) Remove Uses

func (set *Set) Remove(items ...interface{})

Remove removes the items (one or more) from the set.

func (*Set) Size Uses

func (set *Set) Size() int

Size returns number of elements within the set.

func (*Set) String Uses

func (set *Set) String() string

String returns a string representation of container

func (*Set) ToJSON Uses

func (set *Set) ToJSON() ([]byte, error)

ToJSON outputs the JSON representation of the set.

func (*Set) Values Uses

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

Values returns all items in the set.

Package hashset imports 5 packages (graph) and is imported by 50 packages. Updated 2018-09-22. Refresh now. Tools for package owners.