public final class OneMoreElementList<E> extends java.lang.Object implements SimpleList<E>, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
E |
lastElement
The last element in this.
|
SimpleList<E> |
list
All but the last element in this.
|
private static long |
serialVersionUID |
int |
size
The size of this.
|
| Constructor and Description |
|---|
OneMoreElementList(SimpleList<E> list,
E extraElement) |
| Modifier and Type | Method and Description |
|---|---|
E |
get(int index)
Return the element at the given position of this list.
|
SimpleList<E> |
getSublist(int index)
Return a sublist of this list that contains the index.
|
boolean |
isEmpty()
Test if this list is empty.
|
int |
size()
Return the number of elements in this list.
|
java.util.List<E> |
toJDKList()
Returns a java.util.List version of this list.
|
java.lang.String |
toString() |
private static final long serialVersionUID
public final E lastElement
public final SimpleList<E> list
public final int size
public OneMoreElementList(SimpleList<E> list, E extraElement)
public int size()
SimpleListsize in interface SimpleList<E>public boolean isEmpty()
SimpleListisEmpty in interface SimpleList<E>public E get(int index)
SimpleListget in interface SimpleList<E>index - the position for the elementpublic SimpleList<E> getSublist(int index)
SimpleListThe result is always an existing SimpleList, the smallest one that contains the index.
Currently, it is always a SimpleArrayList.
getSublist in interface SimpleList<E>index - the index into this listpublic java.util.List<E> toJDKList()
SimpleListtoJDKList in interface SimpleList<E>List for this listpublic java.lang.String toString()
toString in class java.lang.Object