list

package
v0.0.0-...-38a5715 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package list implements of a doubly link list in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List struct {
	Count int
	// contains filtered or unexported fields
}

List represents a list of nodes.

func (*List) Add

func (l *List) Add(data string) *Node

Add places a new node at the end of the list.

func (*List) AddFront

func (l *List) AddFront(data string) *Node

AddFront places a new node at the front of the list.

func (*List) AddSort

func (l *List) AddSort(data string) *Node

AddSort adds a node based on lexical ordering.

func (*List) Find

func (l *List) Find(data string) (*Node, error)

Find traverses the list looking for the specified data.

func (*List) FindReverse

func (l *List) FindReverse(data string) (*Node, error)

FindReverse traverses the list in the opposite direction looking for the specified data.

func (*List) Operate

func (l *List) Operate(f func(n *Node) error) error

Operate accepts a function that takes a node and calls the specified function for every node found.

func (*List) OperateReverse

func (l *List) OperateReverse(f func(n *Node) error) error

OperateReverse accepts a function that takes a node and calls the specified function for every node found.

func (*List) Remove

func (l *List) Remove(data string) (*Node, error)

Remove traverses the list looking for the specified data and if found, removes the node from the list.

type Node

type Node struct {
	Data string
	// contains filtered or unexported fields
}

Node represents the data being stored.

Jump to

Keyboard shortcuts

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