Skip to content

DsLinkedList

Hyomoto edited this page Dec 12, 2020 · 15 revisions
Jump To Go Back Arguments Methods Variables

DsLinkedList( values... )

Implements: DsChain

A garbage-collected, linear-traversable linked-list.

// no example

Arguments

Name Type Purpose
values... undef none provided

Methods

Jump To top add remove first has_next next find copy is

add( value )

Returns: ChainLink

Name Type Purpose
value mixed The value to add to the list

Adds the given value to the list, and returns the link that contains it.


remove( link )

Returns: N/A undefined

Name Type Purpose
link ChainLink The link to remove.

Removes the given link from the list


first()

Returns: ChainLink (or undefined)

Name Type Purpose
None

Returns the first link in the list. Returns undefined if the list is empty.


has_next( link )

Returns: boolean (true or false)

Name Type Purpose
link ChainLink The link to check.

Returns if there are more links after the specified one.


next( link )

Returns: ChainLink (or undefined)

Name Type Purpose
link ChainLink The link to check.

Returns the next link after the specified one, or undefined if this is the last one.


find( value )

Returns: ChainLink (or undefined)

Name Type Purpose
value mixed The value to check for

Searches the list for the given value and returns the link holding it, or undefined if it isn't found.


copy()

Returns: DsLinkedList

Name Type Purpose
None

Returns a copy of this DsLinkedList.


is( type )

Returns: boolean (true or false)

Name Type Purpose
type Constructor The Constructor to compare this against.

Returns true if the provided type is DsLinkedList.


Variables

Jump To top
  • final - the final link in the list
Clone this wiki locally