PenProfile 2.x

com.livescribe.ext.util
Class LinkedList

java.lang.Object
  extended by com.livescribe.ext.util.LinkedList
All Implemented Interfaces:
Cloneable, Collection, List

public class LinkedList
extends Object
implements Cloneable, List

LinkedList implements the standard Java SE class


Constructor Summary
LinkedList()
           
LinkedList(Collection c)
           
LinkedList(Enumeration en)
           
LinkedList(Object[] o)
           
 
Method Summary
 void add(int index, Object element)
          Inserts supplied object at the specified index
 boolean add(Object o)
          Adds object to the end of the list
 boolean addAll(Collection c)
          Appends collection to the list
 boolean addAll(int index, Collection c)
          Adds collection at index
 void addFirst(Object o)
          Inserts object in the beginning of the list
 void addLast(Object o)
          Appends object to the end of list
 void clear()
          Removes all objects from the list
 Object clone()
          Produces a shallow copy of the list
 boolean contains(Object o)
          Returns if the object exist in the list or not
 boolean containsAll(Collection c)
          Returns true if the list contains all objects in the collection
 Object element()
          Peeks at the first element
 boolean equals(Object o)
          Equals implementation
 Object get(int index)
          Gets the object at index
 Object getFirst()
          Gets the first element
 Object getLast()
          Gets the last (tail) element
 int indexOf(Object o)
          Gets the index of the object.
 boolean isEmpty()
          Returns true if this collection is empty
 Iterator iterator()
          Gets an iterator to the list
 int lastIndexOf(Object o)
          Returns the last occurrence of object in list.
 ListIterator listIterator()
          Gets an iterator to the list
 ListIterator listIterator(int index)
          Returns a ListIterator object to the list starting with object at index
 void offer(Object o)
          Appends object to the end of list
 Object peek()
          Peeks at the first element
 Object poll()
          Removes the first object from the list
 Object remove()
          Removes the first object from the list
 Object remove(int index)
          Removes the object at index
 boolean remove(Object o)
          Removes the first occurence of the object from the list
 boolean removeAll(Collection c)
          Remove all objects in the list that is part of the collection
 Object removeFirst()
          Removes the first object from the list
 Object removeLast()
          Removes the last (tail) object from the list
 boolean retainAll(Collection c)
          Removes all the objects in the list BUT the objects in the collection
 Object set(int index, Object element)
          Replace the object at index with the supplied object
 int size()
          Returns the number of objects in the list
 void sort()
          Sorts the elements.
 List subList(int fromIndex, int toIndex)
          Returns a new Sublist
 Object[] toArray()
          Returns an array containing the objects in the list
 String toString()
          Returns a string of this list
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.livescribe.ext.util.List
hashCode
 

Constructor Detail

LinkedList

public LinkedList()

LinkedList

public LinkedList(Collection c)

LinkedList

public LinkedList(Enumeration en)

LinkedList

public LinkedList(Object[] o)
Method Detail

add

public void add(int index,
                Object element)
Inserts supplied object at the specified index

Specified by:
add in interface List
Parameters:
index -
element -

add

public boolean add(Object o)
Adds object to the end of the list

Specified by:
add in interface Collection
Specified by:
add in interface List
Parameters:
o -
Returns:

addAll

public boolean addAll(Collection c)
Appends collection to the list

Specified by:
addAll in interface Collection
Specified by:
addAll in interface List
Parameters:
c -
Returns:

addAll

public boolean addAll(int index,
                      Collection c)
Adds collection at index

Specified by:
addAll in interface List
Parameters:
index -
c -
Returns:

containsAll

public boolean containsAll(Collection c)
Returns true if the list contains all objects in the collection

Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface List

isEmpty

public boolean isEmpty()
Returns true if this collection is empty

Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface List

removeAll

public boolean removeAll(Collection c)
Remove all objects in the list that is part of the collection

Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface List

retainAll

public boolean retainAll(Collection c)
Removes all the objects in the list BUT the objects in the collection

Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface List

addFirst

public void addFirst(Object o)
Inserts object in the beginning of the list

Parameters:
o -

addLast

public void addLast(Object o)
Appends object to the end of list

Parameters:
o -

offer

public void offer(Object o)
Appends object to the end of list

Parameters:
o -

clear

public void clear()
Removes all objects from the list

Specified by:
clear in interface Collection
Specified by:
clear in interface List

clone

public Object clone()
Produces a shallow copy of the list

Specified by:
clone in interface Cloneable
Returns:

contains

public boolean contains(Object o)
Returns if the object exist in the list or not

Specified by:
contains in interface Collection
Specified by:
contains in interface List
Parameters:
o -
Returns:

get

public Object get(int index)
Gets the object at index

Specified by:
get in interface List
Parameters:
index -
Returns:

getFirst

public Object getFirst()
Gets the first element

Returns:

peek

public Object peek()
Peeks at the first element

Returns:

element

public Object element()
Peeks at the first element

Returns:

getLast

public Object getLast()
Gets the last (tail) element

Returns:

indexOf

public int indexOf(Object o)
Gets the index of the object. If object does no exist function returns -1

Specified by:
indexOf in interface List
Parameters:
o -
Returns:

lastIndexOf

public int lastIndexOf(Object o)
Returns the last occurrence of object in list. If object does not exist the function returns -1

Specified by:
lastIndexOf in interface List

listIterator

public ListIterator listIterator(int index)
Returns a ListIterator object to the list starting with object at index

Specified by:
listIterator in interface List
Parameters:
index -
Returns:

remove

public Object remove(int index)
Removes the object at index

Specified by:
remove in interface List
Parameters:
index -
Returns:

remove

public boolean remove(Object o)
Removes the first occurence of the object from the list

Specified by:
remove in interface Collection
Specified by:
remove in interface List
Parameters:
o -
Returns:

removeFirst

public Object removeFirst()
Removes the first object from the list

Returns:

remove

public Object remove()
Removes the first object from the list

Returns:

poll

public Object poll()
Removes the first object from the list

Returns:

removeLast

public Object removeLast()
Removes the last (tail) object from the list

Returns:

set

public Object set(int index,
                  Object element)
Replace the object at index with the supplied object

Specified by:
set in interface List
Parameters:
index -
element -
Returns:

size

public int size()
Returns the number of objects in the list

Specified by:
size in interface Collection
Specified by:
size in interface List
Returns:

toArray

public Object[] toArray()
Returns an array containing the objects in the list

Specified by:
toArray in interface Collection
Specified by:
toArray in interface List
Returns:

equals

public boolean equals(Object o)
Equals implementation

Specified by:
equals in interface Collection
Specified by:
equals in interface List
Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Boolean.hashCode(), Hashtable

toString

public String toString()
Returns a string of this list

Overrides:
toString in class Object
Returns:
a string representation of the object.

iterator

public Iterator iterator()
Gets an iterator to the list

Specified by:
iterator in interface Collection
Specified by:
iterator in interface List

listIterator

public ListIterator listIterator()
Gets an iterator to the list

Specified by:
listIterator in interface List

subList

public List subList(int fromIndex,
                    int toIndex)
Returns a new Sublist

Specified by:
subList in interface List

sort

public void sort()
Sorts the elements. They must implement Comparable interface


PenProfile 2.x

Copyright © 2010 Livescribe Inc. All Rights Reserved.
Confidential and subject to NDA.