stringset

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: Apache-2.0 Imports: 0 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(s1 Set, s2 Set) bool

Equal returns whether s1 and s2 contain the same elements.

Types

type Set

type Set map[string]struct{}

Set is a nifty little wrapper for common set operations on a map. Because it is equivalent to a map, make/range/len will still work with Set.

func FromSlice

func FromSlice(xs []string) Set

FromSlice converts a slice of strings into a Set.

func New

func New(xs ...string) Set

New creates a new Set with xs.

func (Set) Add

func (s Set) Add(x string)

Add adds x to s.

func (Set) Has

func (s Set) Has(x string) bool

Has returns true if x is in s.

func (Set) Remove

func (s Set) Remove(x string)

Remove removes x from s.

func (Set) Sub

func (s Set) Sub(s2 Set) Set

Sub returns a new set which is the result of s minus s2.

func (Set) ToSlice

func (s Set) ToSlice() []string

ToSlice converts s to a slice.

Jump to

Keyboard shortcuts

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