Back: Link-iteration Up: Base classes Forward: LinkedList-accessing   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.101 LinkedList

Defined in namespace Smalltalk
Superclass: SequenceableCollection
Category: Collections-Sequenceable
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.

1.101.1 LinkedList: accessing  (instance)
1.101.2 LinkedList: adding  (instance)
1.101.3 LinkedList: enumerating  (instance)
1.101.4 LinkedList: testing  (instance)


1.101.1 LinkedList: accessing

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.


1.101.2 LinkedList: adding

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.


1.101.3 LinkedList: enumerating

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


1.101.4 LinkedList: testing

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)



Back: LinkedList-enumerating Up: LinkedList Forward: LookupKey   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on July, 23 2009 using texi2html