Skip to content

kodeyeen/container

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

container

This is an extended version of the Go's builtin container package with support of generics and new 1.23 iterators feature.
There are already similar ones, for example, gods, but I don't like it for being too Java-ish.

Installation

go get github.com/kodeyeen/container

Quickstart

package main

import (
	"cmp"
	"fmt"

	"github.com/kodeyeen/container/pqueue"
)

func main() {
	pq := pqueue.New(cmp.Compare[int])

	pq.Init(44, 22, 11, 33)
	pq.Enqueue(-55)

	min, ok := pq.Peek()
	if ok {
		fmt.Printf("Minimum value is %d\n", min)
	}

	for elem := range pq.All() {
		fmt.Println(elem)
	}
}

About

Go's container package extended.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages