Skip to content

Golang collections for builtin types and generic slices

License

Notifications You must be signed in to change notification settings

martinohmann/collections-go

Repository files navigation

collections-go

Build Status Go Report Card GoDoc

Mutable and immutable collections for commonly used builtin types. This package includes collection types generated by collections-gen for the following builtins:

In addition to that the following hand crafted collection types are included:

Installation

go get github.com/martinohmann/collections-go

Usage

c := collections.NewString([]string{"foo", "bar", "baz"})

items := c.
    Filter(func(item string) bool {
        return strings.HasPrefix(item, "ba")
    }).
    Reverse().
    Prepend("qux").
    Items()

fmt.Println(items)

// Output:
// [qux baz bar]

Check out the godocs for all available collection methods.

License

The source code of collections-go is released under the MIT License. See the bundled LICENSE file for details.

Releases

No releases published

Packages

No packages published

Languages