sparse

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package sparse provides the creation of sparse.Slice via sparse.NewSlice

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrItemNotFound is the error when we could not find an item
	ErrItemNotFound = errors.New("item not found")
)

Functions

This section is empty.

Types

type Iterator

type Iterator interface {
	// Next returns the next element
	Next() Iterator
	// Value returns the current item value
	Value() interface{}
}

Iterator for sparse

type Slice

type Slice interface {
	// Add a new item to the slice
	Add(ref interface{})
	// Remove a item in the slice
	Remove(ref interface{}) error
	// Clear al the items in the slice
	Clear()
	// Size return the number of items in this slice
	Size() int
	// Iterator returns a new sparse.Iterator for sparse.Slice
	Iterator() Iterator
}

Slice is an slice that contains interfaces and reuse slots

func NewSlice

func NewSlice(capacity int, grow int) Slice

NewSlice creates a new sparse.Slice with the given capacity and grow

Jump to

Keyboard shortcuts

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