linkedlist

package
v0.0.0-...-da378b8 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package linkedlist creates a ItemLinkedList data structure for the Item type

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item generic.Type

Item the type of the linked list

type ItemLinkedList

type ItemLinkedList struct {
	// contains filtered or unexported fields
}

ItemLinkedList the linked list of Items

func (*ItemLinkedList) Append

func (ll *ItemLinkedList) Append(t Item)

Append adds an Item to the end of the linked list

func (*ItemLinkedList) Head

func (ll *ItemLinkedList) Head() *Node

Head returns a pointer to the first node of the list

func (*ItemLinkedList) IndexOf

func (ll *ItemLinkedList) IndexOf(t Item) int

IndexOf returns the position of the Item t

func (*ItemLinkedList) Insert

func (ll *ItemLinkedList) Insert(i int, t Item) error

Insert adds an Item at position i

func (*ItemLinkedList) IsEmpty

func (ll *ItemLinkedList) IsEmpty() bool

IsEmpty returns true if the list is empty

func (*ItemLinkedList) RemoveAt

func (ll *ItemLinkedList) RemoveAt(i int) (*Item, error)

RemoveAt removes a node at position i

func (*ItemLinkedList) Size

func (ll *ItemLinkedList) Size() int

Size returns the linked list size

func (*ItemLinkedList) String

func (ll *ItemLinkedList) String()

Insert adds an Item at position i

type Node

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

Node a single node that composes the list

Jump to

Keyboard shortcuts

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