com.neeve.util
Class UtlList

java.lang.Object
  extended by com.neeve.util.UtlListElement
      extended by com.neeve.util.UtlList

public class UtlList
extends UtlListElement

Doubly linked list.

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.

Threading:
This class is not safe for concurrent access by multiple threads.

Field Summary
 
Fields inherited from class com.neeve.util.UtlListElement
count, head, next, prev
 
Method Summary
 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
 
Methods inherited from class com.neeve.util.UtlListElement
count, insertAfter, insertBefore, isLinked, next, previous, unlink, wipe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static UtlList create()
Factory method - Creates a list

This method creates a new linked list.

Threading:
This method is safe for concurrent access by multiple threads

prepend

public final void prepend(UtlListElement element)
Prepend an element to the list.

Parameters:
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.

Threading:
This method is not safe for concurrent access by multiple threads

append

public final void append(UtlListElement element)
Append an element to the list.

Parameters:
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.

Threading:
This method is not safe for concurrent access by multiple threads

first

public final UtlListElement first()
Get the first element in the list.

Returns:
The first element in the list

This method returns the first element in the list.

Threading:
This method is not safe for concurrent access by multiple threads

last

public final UtlListElement last()
Get the last element in the list.

Returns:
The last element in the list

This method returns the last element in the list.

Threading:
This method is not safe for concurrent access by multiple threads

prune

public final void prune(UtlListElement element,
                        int num)
Prunes a portion of the list

Parameters:
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.

Threading:
This method is not safe for concurrent access by multiple threads

clear

public final void clear()
Clears a list.

This method empties out a list i.e. all references to previously linked elements are released and the count set to zero.

Threading:
This method is not safe for concurrent access by multiple threads

toString

public String toString()
Get a string representation of the list

Overrides:
toString in class Object


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.