readyset

package module
v0.0.0-...-1598868 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2014 License: Apache-2.0 Imports: 1 Imported by: 0

README

readyset provides a simple library for dealing with unordered sets of data in Go.

GoDoc


License

Copyright 2014 Jason Hall

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Documentation

Overview

Package readyset provides a simple set implementation.

Elements in the set must be hashable (e.g., no slices)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Set

type Set map[interface{}]struct{}

Set is a container for arbitrary data which ensures that duplicates elements will not be stored multiple times.

func Intersection

func Intersection(a, b Set) Set

Intersection returns a set containing all elements contained in both given sets.

func NewSet

func NewSet(in ...interface{}) Set

NewSet creates a new Set containing the given elements.

func Union

func Union(a, b Set) Set

Intersection returns a set containing all elements contained in either of the given sets.

func (Set) Add

func (set Set) Add(is ...interface{})

Add adds the given elements to the set.

func (Set) Contains

func (set Set) Contains(i interface{}) bool

Contains returns whether the given element is in the set.

func (Set) Len

func (set Set) Len() int

Len returns the size of the set.

func (Set) Remove

func (set Set) Remove(is ...interface{})

Remove removes the given elements from the set.

func (Set) Slice

func (set Set) Slice() []interface{}

Slice returns the elements of the set as a slice.

func (Set) String

func (set Set) String() string

String renders a string representation of the set.

Jump to

Keyboard shortcuts

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