Package jade.util.leap
Class LinkedList
- java.lang.Object
-
- jade.util.leap.LinkedList
-
- All Implemented Interfaces:
Collection,List,Serializable,Serializable
public class LinkedList extends Object implements List, Serializable
The LEAP (environment-dependent) version of the &qote;java.util.ArrayList&qote; class. This class appears to be exactly the same in J2SE, PJAVA and MIDP. The internal implementation is different in the three cases however.- Version:
- 1.0, 29/09/00
- Author:
- Nicolas Lhuillier
- See Also:
LinkedList, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LinkedList()Default Constructor, creates an empty List
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Object o)Inserts the specified element at the specified position in this listbooleanadd(Object o)Adds an element.voidaddFirst(Object o)Inserts the given element at the beginning of this list.voidaddLast(Object o)Appends the given element to the end of this list.voidclear()Removes all of the elements from this list (optional operation).booleancontains(Object o)Returns true if this list contains the specified element.Objectget(int index)Returns the element at the specified position in this list.intindexOf(Object o)Returns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.booleanisEmpty()Checks if the collection contains elements.Iteratoriterator()Returns an iterator over the elements in this collection.Objectremove(int index)Removes the element at the specified position in this list.booleanremove(Object o)Removes one instance of the specified element.ObjectremoveFirst()Removes and returns the first element from this list.intsize()Returns the number of elements in this collection.Object[]toArray()Returns an array containing all of the elements in this collection.StringtoString()
-
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:ListRemoves all of the elements from this list (optional operation). This list will be empty after this call returns.
-
contains
public boolean contains(Object o)
Description copied from interface:ListReturns true if this list contains the specified element.
-
get
public Object get(int index)
Description copied from interface:ListReturns the element at the specified position in this list.
-
indexOf
public int indexOf(Object o)
Description copied from interface:ListReturns the index in this list of the first occurrence of the specified element, or -1 if this list does not contain this element.
-
remove
public Object remove(int index)
Description copied from interface:ListRemoves the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
-
add
public boolean add(Object o)
Description copied from interface:CollectionAdds an element.- Specified by:
addin interfaceCollection- Returns:
- true if the element has been added.
- See Also:
interface
-
add
public void add(int index, Object o)Inserts the specified element at the specified position in this list
-
isEmpty
public boolean isEmpty()
Description copied from interface:CollectionChecks if the collection contains elements.- Specified by:
isEmptyin interfaceCollection- Returns:
- true if this collection contains no elements
- See Also:
interface
-
remove
public boolean remove(Object o)
Description copied from interface:CollectionRemoves one instance of the specified element.- Specified by:
removein interfaceCollection- Parameters:
o- the element to be removed- Returns:
- true if the element has been removed
- See Also:
interface
-
iterator
public Iterator iterator()
Description copied from interface:CollectionReturns an iterator over the elements in this collection. There are no guarantees concerning the order in which the elements are returned.- Specified by:
iteratorin interfaceCollection- Returns:
- an Iterator over the elements in this collection
- See Also:
interface
-
toArray
public Object[] toArray()
Description copied from interface:CollectionReturns an array containing all of the elements in this collection.- Specified by:
toArrayin interfaceCollection- Returns:
- an array containing all of the elements in this collection
- See Also:
interface
-
size
public int size()
Description copied from interface:CollectionReturns the number of elements in this collection.- Specified by:
sizein interfaceCollection- Returns:
- the number of elements in this collection.
- See Also:
interface
-
removeFirst
public Object removeFirst()
Removes and returns the first element from this list.- Returns:
- the first element from this list.
- Throws:
NoSuchElementException- 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.
-
-