|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMysteryListImplementation<T>
T
- The type of data that the list stores.public class MysteryListImplementation<T>
An implementation of the List ADT.
Constructor Summary | |
---|---|
MysteryListImplementation()
Default constructor: creates an empty list. |
Method Summary | |
---|---|
boolean |
add(int newPosition,
T newItem)
Adds newItem at the given index, and shifts each item at or beyond that index to the next higher index. |
void |
add(T newItem)
Adds newItem to the end of the list. |
T |
at(int position)
Returns the item at a given index. |
void |
clear()
Removes all items from the list. |
boolean |
contains(T targetItem)
Returns true if the list contains the target item. |
boolean |
isEmpty()
Returns true if the list has no items stored in it. |
java.util.Iterator<T> |
iterator()
Returns an iterator that begins just before index 0 in this list. |
int |
length()
Returns the length of the list: the number of items stored in it. |
static void |
main(java.lang.String[] args)
|
T |
remove(int position)
Removes the item at the given index, and shifts each item beyond that index to the next lower index. |
boolean |
replace(int position,
T newItem)
Replaces the item at a given index. |
java.lang.Object[] |
toArray()
Returns an array version of the list. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MysteryListImplementation()
Method Detail |
---|
public void add(T newItem)
add
in interface List<T>
public boolean add(int newPosition, T newItem)
add
in interface List<T>
public T remove(int position)
remove
in interface List<T>
public void clear()
List
clear
in interface List<T>
public boolean replace(int position, T newItem)
List
replace
in interface List<T>
public T at(int position)
List
at
in interface List<T>
public boolean contains(T targetItem)
List
contains
in interface List<T>
public int length()
List
length
in interface List<T>
public boolean isEmpty()
List
isEmpty
in interface List<T>
public java.lang.Object[] toArray()
List
toArray
in interface List<T>
public java.util.Iterator<T> iterator()
List
iterator
in interface java.lang.Iterable<T>
iterator
in interface List<T>
public static void main(java.lang.String[] args)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |