datastructures

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2017 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StringSet

type StringSet map[string]struct{}

StringSet is a set of strings, supporting basic set and inter-set operations. The StringSet is abstracted on top of a map[string]struct{}, so it also supports range-style iteration, as well as direct map operations. The implementation is not thread-safe.

func NewDefaultStringSet

func NewDefaultStringSet() StringSet

NewDefaultStringSet creates a new StringSet with a default initial capacity.

func NewStringSet

func NewStringSet(initialCapacity int) StringSet

NewStringSet creates a new StringSet with the specified initial capacity.

func (StringSet) Add

func (set StringSet) Add(s string) bool

Add the given string to the set. Returns true if the set has changed, and false otherwise.

func (StringSet) Difference

func (set StringSet) Difference(otherSet StringSet) StringSet

Difference creates a set containing all elements in the receiver set which are not in the given set.

func (StringSet) Exists

func (set StringSet) Exists(s string) bool

Exists returns whether the given string is in the set.

func (StringSet) Intersection

func (set StringSet) Intersection(otherSet StringSet) StringSet

Intersection creates a set containing all elements in both the receiver set and the given set.

func (StringSet) Remove

func (set StringSet) Remove(s string) bool

Remove the given string from the set. Returns true if the set has changed, and false otherwise.

func (StringSet) Union

func (set StringSet) Union(otherSet StringSet) StringSet

Union creates a set containing all elements in either the receiver set or the given set.

Jump to

Keyboard shortcuts

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