"

2013 FRC Java API

"

com.sun.squawk.util
Class SimpleLinkedList

java.lang.Object
  extended by com.sun.squawk.util.SimpleLinkedList

public final class SimpleLinkedList
extends Object

A Stripped down version of the standard J2SE java.util.LinkedList class. Can be useds as a FIFO queue by adding and removing from opposite ends. This class is NOT synchronized.


Constructor Summary
SimpleLinkedList()
          Constructs an empty list.
 
Method Summary
 void addFirst(Object o)
          Inserts the given element at the beginning of this list.
 void addLast(Object o)
          Appends the given element to the end of this list.
 void clear()
          Removes all of the elements from this list.
 boolean contains(Object o)
          Returns true if this list contains the specified element.
 Enumeration elements()
          Returns an enumeration of the components of this vector.
 Object getFirst()
          Returns the first element in this list.
 Object getLast()
          Returns the last element in this list.
 int indexOf(Object o)
          Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element.
 boolean remove(Object o)
          Removes the first occurrence of the specified element in this list.
 Object removeFirst()
          Removes and returns the first element from this list.
 Object removeLast()
          Removes and returns the last element from this list.
 int size()
          Returns the number of elements in this list.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLinkedList

public SimpleLinkedList()
Constructs an empty list.

Method Detail

getFirst

public Object getFirst()
Returns the first element in this list.

Returns:
the first element in this list.
Throws:
IllegalStateException - if this list is empty.

getLast

public Object getLast()
Returns the last element in this list.

Returns:
the last element in this list.
Throws:
IllegalStateException - if this list is empty.

removeFirst

public Object removeFirst()
Removes and returns the first element from this list.

Returns:
the first element from this list.
Throws:
IllegalStateException - if this list is empty.

removeLast

public Object removeLast()
Removes and returns the last element from this list.

Returns:
the last element from this list.
Throws:
IllegalStateException - if this list is empty.

addFirst

public void addFirst(Object o)
Inserts the given element at the beginning of this list.

Parameters:
o - the element to be inserted at the beginning of this list.

addLast

public void addLast(Object o)
Appends the given element to the end of this list. (Identical in function to the add method; included only for consistency.)

Parameters:
o - the element to be inserted at the end of this list.

size

public final int size()
Returns the number of elements in this list.

Returns:
the number of elements in this list.

remove

public boolean remove(Object o)
Removes the first occurrence of the specified element in this list. If the list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an element exists).

Parameters:
o - element to be removed from this list, if present.
Returns:
true if the list contained the specified element.

contains

public boolean contains(Object o)
Returns true if this list contains the specified element. More formally, returns true if and only if this list contains at least one element e such that (o==null ? e==null : o.equals(e)).

Parameters:
o - element whose presence in this list is to be tested.
Returns:
true if this list contains the specified element.

indexOf

public int indexOf(Object o)
Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.

Parameters:
o - element to search for.
Returns:
the index in this list of the first occurrence of the specified element, or -1 if the list does not contain this element.

clear

public void clear()
Removes all of the elements from this list.


elements

public Enumeration elements()
Returns an enumeration of the components of this vector.

Returns:
an enumeration of the components of this vector.
See Also:
Enumeration

"

2013 FRC Java API

"

"
For updated information see the Java FRC site
"