stringset

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2023 License: Apache-2.0 Imports: 8 Imported by: 99

README

GitHub Test Status GoDoc License Go Report CodeFactor Maintainability Codecov

String Set

Other Contributors

Licensing License

This program is free software: you can redistribute it and/or modify it under the terms of the Apache license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deduplicate

func Deduplicate(input []string) []string

Deduplicate utilizes the Set type to generate a unique list of strings from the input slice.

Types

type Set

type Set struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(initial ...string) *Set

New returns a Set containing the values provided in the arguments.

func (*Set) Close

func (s *Set) Close()

func (*Set) Has

func (s *Set) Has(element string) bool

Has returns true if the receiver Set already contains the element string argument.

func (*Set) Insert

func (s *Set) Insert(element string)

Insert adds the element string argument to the receiver Set.

func (*Set) InsertMany

func (s *Set) InsertMany(elements ...string)

InsertMany adds all the elements strings into the receiver Set.

func (*Set) Intersect

func (s *Set) Intersect(other *Set)

Intersect causes the receiver Set to only contain elements also found in the other Set argument.

func (*Set) Len

func (s *Set) Len() int

Len returns the number of elements in the receiver Set.

func (*Set) Remove

func (s *Set) Remove(element string)

Remove will delete the element string from the receiver Set.

func (*Set) Set

func (s *Set) Set(input string) error

Set implements the flag.Value interface.

func (*Set) Slice

func (s *Set) Slice() []string

Slice returns a string slice that contains all the elements in the Set.

func (*Set) String

func (s *Set) String() string

Set implements the flag.Value interface.

func (*Set) Subtract

func (s *Set) Subtract(other *Set)

Subtract removes all elements in the other Set argument from the receiver Set.

func (*Set) Union

func (s *Set) Union(other *Set)

Union adds all the elements from the other Set argument into the receiver Set.

Jump to

Keyboard shortcuts

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