|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectLinkedList<E>
public class LinkedList<E>
Constructor Summary | |
---|---|
LinkedList()
|
Method Summary | |
---|---|
void |
add(E item)
Add an item to the end of this list. |
void |
addFirst(E item)
add item to the front of the list. |
void |
addLast(E item)
add item to the end of the list. |
boolean |
equals(Object other)
check if this list is equal to another Object. |
E |
get(int pos)
Get an element from the list. |
IList<E> |
getSubList(int start,
int stop)
Return a sublist of elements in this list from start inclusive to stop exclusive. |
int |
indexOf(E item)
Find the position of an element in the list. |
int |
indexOf(E item,
int pos)
find the position of an element in the list starting at a specified position. |
void |
insert(int pos,
E item)
Insert an item at a specified position in the list. |
Iterator<E> |
iterator()
return an Iterator for this list. |
void |
makeEmpty()
return the list to an empty state. |
boolean |
remove(E obj)
Remove the first occurrence of obj in this list. |
E |
remove(int pos)
Remove an element in the list based on position. |
E |
removeFirst()
remove and return the first element of this list. |
E |
removeLast()
remove and return the last element of this list. |
void |
removeRange(int start,
int stop)
Remove all elements in this list from start inclusive to stop exclusive. |
E |
set(int pos,
E item)
Change the data at the specified position in the list. |
int |
size()
Return the size of this list. |
String |
toString()
Return a String version of this list enclosed in square brackets, []. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LinkedList()
Method Detail |
---|
public void add(E item)
IList
add
in interface IList<E>
item
- the data to be added to the end of this listpublic void insert(int pos, E item)
IList
insert
in interface IList<E>
pos
- the position to insert the data at in the listitem
- the data to add to the listpublic E set(int pos, E item)
IList
set
in interface IList<E>
pos
- the position in the list to overwriteitem
- the new item that will overwrite the old item
public E get(int pos)
IList
get
in interface IList<E>
pos
- specifies which element to get
public E remove(int pos)
IList
remove
in interface IList<E>
pos
- the position of the element to remove from the list
public boolean remove(E obj)
IList
remove
in interface IList<E>
obj
- The item to remove from this list.
public IList<E> getSubList(int start, int stop)
IList
getSubList
in interface IList<E>
start
- index of the first element of the sublist.stop
- stop - 1 is the index of the last element of the sublist.
public int size()
IList
size
in interface IList<E>
public int indexOf(E item)
IList
indexOf
in interface IList<E>
item
- the element to search for in the list
public int indexOf(E item, int pos)
IList
indexOf
in interface IList<E>
item
- the element to search for in the listpos
- the position in the list to start searching from
public void makeEmpty()
IList
makeEmpty
in interface IList<E>
public Iterator<E> iterator()
IList
iterator
in interface IList<E>
iterator
in interface Iterable<E>
public void removeRange(int start, int stop)
IList
removeRange
in interface IList<E>
start
- position at beginning of range of elements to be removedstop
- stop - 1 is the position at the end of the range of elements to be removedpublic void addFirst(E item)
item
- the data to add to the front of this listpublic void addLast(E item)
item
- the data to add to the end of this listpublic E removeFirst()
public E removeLast()
public String toString()
IList
toString
in interface IList<E>
toString
in class Object
public boolean equals(Object other)
equals
in interface IList<E>
equals
in class Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |