container

package module
v0.0.0-...-3590e8a Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2015 License: MIT Imports: 0 Imported by: 0

README

container GoDoc Build Status

Go comes currently only with a few types of data structures. I want to change this disadvantage with this repository. (Besides learning some new things of course.) As I'm doing this in my spare time I do not expect on finishing this project anytime soon.

You can find a list of data structures I want to implement on Wikipedia's excellent List of data structures article.

Linear data structures

Lists

Trees

Binary Trees

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Container

type Container interface {
	// Clear resets the container to zero elements and resets the container's meta data
	Clear()
	// Len returns the current count of container elements
	Len() int
	// Empty returns true if the current count of container elements is zero
	Empty() bool

	// Chan returns a channel which iterates from the front to the back of the container
	Chan(n int) <-chan interface{}
	// ChanBack returns a channel which iterates from the back to the front of the container
	ChanBack(n int) <-chan interface{}

	// Iter returns an iterator which starts at the front of the container, or nil if there are no elements in the container
	Iter() Iterator
	// IterBack returns an iterator which starts at the back of the container, or nil if there are no elements in the container
	IterBack() Iterator

	// Contains returns true if an element identified by the given id value exists in the container, or false if it does not
	Contains(id interface{}) bool

	// Slice returns a copy of the container as a slice
	Slice() []interface{}
}

Container defines a container

type Iterator

type Iterator interface {
	// Next iterates to the next element in the container and returns the iterator, or nil if there is no next element
	Next() Iterator
	// Previous iterates to the previous element in the container and returns the iterator, or nil if there is no previous element
	Previous() Iterator

	// Get returns the value of the iterator's current element
	Get() interface{}
}

Iterator defines a container iterator

Directories

Path Synopsis
test

Jump to

Keyboard shortcuts

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