T
- a generic typepublic abstract class NodeAndIterators<T> extends java.lang.Object implements MyList<T>
Modifier and Type | Class and Description |
---|---|
class |
NodeAndIterators.MyListIterator
Students don't have to implement Java ListIterator<T> interface for this inner class.
|
Constructor and Description |
---|
NodeAndIterators()
This is the constructor that simply set head to null
|
Modifier and Type | Method and Description |
---|---|
T |
get(int at)
Get the element at index i
|
java.util.Iterator<T> |
iterator() |
java.util.ListIterator<T> |
listIterator() |
T |
set(int at,
T data)
Replace the element at i with new one provided by the parameter item.
|
int |
size() |
<K> K[] |
toArray(K[] a)
Returns an array that contains every element in this MyList.
|
java.lang.String |
toString()
Override toString method so it will return a String started and ended by [ and ],
respectively, in which all elements' results of their own toString() will be
concatenated according to their order in the list.
|
public NodeAndIterators()
public T get(int at)
MyList
get
in interface MyList<T>
at
- is an int.MyList.get(int)
public T set(int at, T data)
MyList
set
in interface MyList<T>
at
- is an int.data
- is a T.MyList.set(int, java.lang.Object)
public int size()
size
in interface MyList<T>
MyList.size()
public <K> K[] toArray(K[] a)
MyList
public java.lang.String toString()
MyList
public java.util.ListIterator<T> listIterator()