public class UtlList extends UtlListElement
This class represents a linked list. Elements in such a list have to be of
type UtlListElement
This class IS NOT intended to be used by end users.
count, head, next, prev
Modifier and Type | Method and Description |
---|---|
void |
append(UtlListElement element)
Append an element to the list.
|
void |
clear()
Clears a list.
|
static UtlList |
create()
Factory method - Creates a list
This method creates a new linked list.
|
UtlListElement |
first()
Get the first element in the list.
|
UtlListElement |
last()
Get the last element in the list.
|
void |
prepend(UtlListElement element)
Prepend an element to the list.
|
void |
prune(UtlListElement element,
int num)
Prunes a portion of the list
|
String |
toString()
Get a string representation of the list
|
count, insertAfter, insertBefore, isLinked, next, previous, unlink, wipe
public static UtlList create()
This method creates a new linked list.
public final void prepend(UtlListElement element)
element
- The element to be prepended
This method prepends an element to a list i.e. adds the element before the first element in the list.
public final void append(UtlListElement element)
element
- The element to be appended
This method appends an element to a list i.e. adds the element after the last element in the list.
public final UtlListElement first()
This method returns the first element in the list.
public final UtlListElement last()
This method returns the last element in the list.
public final void prune(UtlListElement element, int num)
element
- The element upto but excluding which the list is to be
cleared. A value of null is the same as specifying that the entire
list needs to be cleared.num
- The number of elements that are to be removed
This method removes all elements upto but excluding the specified element from the list.
public final void clear()
This method empties out a list i.e. all references to previously linked elements are released and the count set to zero.
Copyright © 2019 Neeve Research, LLC. All Rights Reserved.