Package randoop.util
Class OneMoreElementList<E>
- java.lang.Object
-
- randoop.util.OneMoreElementList<E>
-
- All Implemented Interfaces:
Serializable
,SimpleList<E>
public final class OneMoreElementList<E> extends Object implements SimpleList<E>, Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description OneMoreElementList(SimpleList<E> list, E extraElement)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.List<E>
toJDKList()
Returns a java.util.List version of this list.String
toString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
lastElement
public final E lastElement
The last element in this.
-
list
public final SimpleList<E> list
All but the last element in this.
-
size
public final int size
The size of this.
-
-
Constructor Detail
-
OneMoreElementList
public OneMoreElementList(SimpleList<E> list, E extraElement)
-
-
Method Detail
-
size
public int size()
Description copied from interface:SimpleList
Return the number of elements in this list.- Specified by:
size
in interfaceSimpleList<E>
- Returns:
- the number of elements in this list
-
isEmpty
public boolean isEmpty()
Description copied from interface:SimpleList
Test if this list is empty.- Specified by:
isEmpty
in interfaceSimpleList<E>
- Returns:
- true if this list is empty, false otherwise
-
get
public E get(int index)
Description copied from interface:SimpleList
Return the element at the given position of this list.- Specified by:
get
in interfaceSimpleList<E>
- Parameters:
index
- the position for the element- Returns:
- the element at the index
-
getSublist
public SimpleList<E> getSublist(int index)
Description copied from interface:SimpleList
Return a sublist of this list that contains the index. Does not necessarily contain the first element.The result is always an existing SimpleList, the smallest one that contains the index. Currently, it is always a
SimpleArrayList
.- Specified by:
getSublist
in interfaceSimpleList<E>
- Parameters:
index
- the index into this list- Returns:
- the sublist containing this index
-
toJDKList
public List<E> toJDKList()
Description copied from interface:SimpleList
Returns a java.util.List version of this list. Caution: this operation can be expensive.- Specified by:
toJDKList
in interfaceSimpleList<E>
- Returns:
List
for this list
-
-