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). |
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. |
Click to show internal directories.
Click to hide internal directories.