Skip to content

cholland1989/go-collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-collection Documentation Build Status

Generic list, map, and set definitions with common utility methods.

Installation

go get github.com/cholland1989/go-collection

This library supports version 1.20 and later of Go.

Usage

import "github.com/cholland1989/go-collection/pkg/collection"

Lists can be used interchangeably with slices of the same type, and support all of the same built-in functions such as make, append, and range:

values := make(collection.List[int], 0)
values.AddAll(0, 1, 0, 1)
for index, value := range values {
	fmt.Println(index, value)
}

Maps can be used interchangeably with maps of the same type, and support all of the same built-in functions such as make, delete, and range:

values := make(collection.Map[int, int])
values.Put(0, 1)
values.Put(1, 0)
for key, value := range values {
	fmt.Println(key, value)
}

Sets can be used interchangeably with a map of empty structs, and support all of the same built-in functions such as make, delete, and range:

values := make(collection.Set[int])
values.AddAll(0, 1, 0, 1)
for value := range values {
	fmt.Println(value)
}

See the documentation for more details.

License

Released under the MIT License.

About

Generic list, map, and set definitions with common utility methods.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors