golang-set

module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0

README

RAITO - GO set

Go Report CardVersion Build Coverage Contribute Go version Software License Go Reference

Introduction

This library introduce sets in golang.

Set is a container that store unique elements in no particular order. Sets are an alias for map[T]struct{} where T is a comparable type.

Getting Started

Add this library as a dependency via go get github.com/raito-io/golang-set

Examples

import github.com/raito-io/golang-set/set

func Foo() {
	var a set.Set[int]
	
	a = set.NewSet[int](2, 5, 9, 7)
	
	l := len(a) //l = 4
	
	contains := a.Contains(4) //false
	
	for i := range(a) {
	    //loop over all elements in the set	
    }
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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