Help us shape the future of Go! Take the 2026 Go Developer Survey

container

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package sets implements basic set types.

Copyright 2015 by Leipzig University Library, http://ub.uni-leipzig.de
                  The Finc Authors, http://finc.info
                  Martin Czygan, <martin.czygan@uni-leipzig.de>

This file is part of some open source application.

Some open source application is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Some open source application is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Foobar. If not, see <http://www.gnu.org/licenses/>.

@license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MapDefault added in v0.1.333

type MapDefault map[string]string

MapDefault provides defaults for string map lookups with defaults.

func (MapDefault) Lookup added in v0.1.333

func (m MapDefault) Lookup(key, def string) string

Lookup map with a default value.

type MapSliceDefault added in v0.1.333

type MapSliceDefault map[string][]string

MapSliceDefault provides defaults for string map lookups.

func (MapSliceDefault) Lookup added in v0.1.333

func (m MapSliceDefault) Lookup(key string, def []string) []string

Lookup with default value.

type StringSet

type StringSet struct {
	Set map[string]struct{}
}

StringSet is map disguised as set.

func NewStringSet

func NewStringSet(s ...string) *StringSet

NewStringSet returns an empty string set. XXX: Make the zero value usable.

func (*StringSet) Add

func (set *StringSet) Add(ss ...string)

Add adds a string to a set, returns true if added, false it it already existed (noop).

func (*StringSet) Contains

func (set *StringSet) Contains(s string) bool

Contains returns true if given string is in the set, false otherwise.

func (*StringSet) Difference added in v0.1.258

func (set *StringSet) Difference(other *StringSet) *StringSet

Difference returns all items, that are in set but not in other.

func (*StringSet) Intersection added in v0.1.258

func (set *StringSet) Intersection(other *StringSet) *StringSet

Intersection returns the intersection of two string sets.

func (*StringSet) Size

func (set *StringSet) Size() int

Size returns current number of elements in the set.

func (*StringSet) SortedValues

func (set *StringSet) SortedValues() []string

SortedValues returns the set values as a sorted string slice.

func (*StringSet) Values

func (set *StringSet) Values() []string

Values returns the set values as a string slice.

Jump to

Keyboard shortcuts

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