Constructor and Description |
---|
MysteryListImplementation()
Constructs an empty list.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int newPosition,
T newItem)
Adds newItem at the given 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 |
equals(java.lang.Object o) |
int |
hashCode() |
boolean |
isEmpty()
Returns true if the list is empty.
|
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.
|
T |
remove(int position)
Removes the item at the given index, and returns it.
|
void |
replace(int position,
T newItem)
Replaces the item at a given index.
|
java.lang.Object[] |
toArray()
Returns an array version of the list.
|
java.lang.String |
toString() |
public MysteryListImplementation()
public void add(T newItem)
List
public void add(int newPosition, T newItem)
List
public T remove(int position)
List
public void clear()
List
public T at(int position)
List
public void replace(int position, T newItem)
List
public boolean contains(T targetItem)
List
public int length()
List
public boolean isEmpty()
List
public java.lang.Object[] toArray()
List
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object