container

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package container provides OOP-style containers.

For better performance, all functions in this package and its subpackages are unsafe for concurrency unless otherwise specified.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container[Item any] interface {
	// Len returns the number of items in the container.
	Len() int

	// Range accesses the items in the container.
	// Each item is accessed once.
	// The order of the access depends on the specific implementation.
	//
	// Its parameter handler is a function to deal with the item x in the
	// container and report whether to continue to access the next item.
	//
	// The client should do read-only operations on x
	// to avoid corrupting the container.
	Range(handler func(x Item) (cont bool))
}

Container is an interface representing a general container.

type Filter added in v0.7.0

type Filter[Item any] interface {
	// Filter refines items in the container.
	//
	// Its parameter filter is a function to report whether to keep the item x.
	Filter(filter func(x Item) (keep bool))
}

Filter wraps the method Filter that refines items in the container.

Its implementation should use an in-place refinement if possible.

Directories

Path Synopsis
Package heap provides OOP-style heap-based containers (such as priority queues).
Package heap provides OOP-style heap-based containers (such as priority queues).
pqueue
Package pqueue provides OOP-style priority queues.
Package pqueue provides OOP-style priority queues.
topkbuf
Package topkbuf provides OOP-style buffers for storing the top-K greatest items.
Package topkbuf provides OOP-style buffers for storing the top-K greatest items.
Package mapping provides OOP-style maps.
Package mapping provides OOP-style maps.
Package sequence provides OOP-style sequences.
Package sequence provides OOP-style sequences.
array
Package array provides OOP-style arrays (direct-access sequences).
Package array provides OOP-style arrays (direct-access sequences).
set
Package set provides OOP-style sets.
Package set provides OOP-style sets.
mapset
Package mapset provides an implementation of interface github.com/donyori/container/set.Set based on Go map.
Package mapset provides an implementation of interface github.com/donyori/container/set.Set based on Go map.

Jump to

Keyboard shortcuts

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