Category: Collections-Sequenceable
Superclass: SequenceableCollection
I provide methods that access and manipulate linked lists. I assume that the elements of the linked list are subclasses of Link, because I use the methods that class Link supplies to implement my methods.

Method category index

accessing (instance)
adding (instance)
enumerating (instance)
iteration (instance)
testing (instance)

accessing (instance)

at: index
Return the element that is index into the linked list.

at: index put: object

This method should not be called for instances of this class.

top


adding (instance)

add: aLink
Add aLink at the end of the list; return aLink.

addFirst: aLink

Add aLink at the head of the list; return aLink.

addLast: aLink

Add aLink at then end of the list; return aLink.

remove: aLink ifAbsent: aBlock

Remove aLink from the list and return it, or invoke aBlock if it's not found in the list.

removeFirst

Remove the first element from the list and return it, or error if the list is empty.

removeLast

Remove the final element from the list and return it, or error if the list is empty.

top


enumerating (instance)

do: aBlock
Enumerate each object in the list, passing it to aBlock (actual behavior might depend on the subclass of Link that is being used).

identityIncludes: anObject

Answer whether we include the anObject object

includes: anObject

Answer whether we include anObject

top


iteration (instance)

first
Retrieve the first element of the list and return it, or error if the list is empty.

last

Retrieve the last element of the list and return it, or error if the list is empty.

top


testing (instance)

isEmpty
Returns true if the list contains no members

notEmpty

Returns true if the list contains at least a member

size

Answer the number of elements in the list. Warning: this is O(n)

top