com.neeve.util
Class UtlPlist<T>

java.lang.Object
  extended by com.neeve.util.UtlPlist<T>

public class UtlPlist<T>
extends Object

Doubly linked 'pointer' list.

This class represents a linked list. As opposed to UtlPlist, this list allows the same object to be linked into multiple lists.

This class IS NOT intended to be used by end users.

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

Nested Class Summary
static class UtlPlist.Element<T>
          The default element class.
static class UtlPlist.ElementFactory<T>
          The pool factory for the default element.
 
Method Summary
 UtlPlist.Element<T> append(T object)
          Append an object to a list.
 UtlPlist.Element<T> append(UtlPlist.Element<T> element)
          Append an element to a list.
 void clear()
          Clears a list.
 int count()
           
static
<T> UtlPlist<T>
create()
          Create a list that uses the default indirection element.
 UtlPlist.Element<T> first()
          Get the first list element.
 UtlPlist.Element<T> last()
          Get the last list element.
 UtlPlist.Element<T> prepend(T object)
          Prepend an object to a list.
 void remove(UtlPlist.Element<T> element)
          Remove an element from a list.
 String toString()
          Get a string representation of the list
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static <T> UtlPlist<T> create()
Create a list that uses the default indirection element.

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

prepend

public final UtlPlist.Element<T> prepend(T object)
Prepend an object to a list.

Parameters:
object - The object to be prepended. This value can be null.

This method prepends an object to a list i.e. adds the object before the first object in the list.

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

append

public final UtlPlist.Element<T> append(T object)
Append an object to a list.

Parameters:
object - The object to be appended. This value can be null.

This method appends an object to a list i.e. adds the object after the last object in the list.

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

append

public final UtlPlist.Element<T> append(UtlPlist.Element<T> element)
Append an element to a list.

Parameters:
element - The element to be appended. This value cannot be null.

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 UtlPlist.Element<T> first()
Get the first list element.

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 UtlPlist.Element<T> last()
Get the last list element.

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

remove

public final void remove(UtlPlist.Element<T> element)
Remove an element from a list.

Removing an element from a list using this method is preferred since it puts the removed element into the element pool enabling reuse of pool object i.e. reduced garbage collection


count

public final int count()

clear

public final void clear()
Clears a list.

This method empties out a list i.e. all elements are removed

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.