public interface IList<E> extends Iterable<E>
Modifier and Type | Method and Description |
---|---|
void |
add(E item)
Add an item to the end of this list.
|
boolean |
equals(Object other)
Determine if this IList is equal to other.
|
E |
get(int pos)
Get an element from the list.
|
IList<E> |
getSubList(int start,
int stop)
Return a sublist of elements in this list
from start inclusive to stop exclusive.
|
int |
indexOf(E item)
Find the position of an element in the list.
|
int |
indexOf(E item,
int pos)
find the position of an element in the list starting
at a specified position.
|
void |
insert(int pos,
E item)
Insert an item at a specified position in the list.
|
Iterator<E> |
iterator()
return an Iterator for this list.
|
void |
makeEmpty()
return the list to an empty state.
|
boolean |
remove(E obj)
Remove the first occurrence of obj in this list.
|
E |
remove(int pos)
Remove an element in the list based on position.
|
void |
removeRange(int start,
int stop)
Remove all elements in this list from start
inclusive to stop exclusive.
|
E |
set(int pos,
E item)
Change the data at the specified position in the list.
|
int |
size()
Return the size of this list.
|
String |
toString()
Return a String version of this list enclosed in
square brackets, [].
|
forEach, spliterator
void add(E item)
item
- the data to be added to the end of this list,
item != nullboolean equals(Object other)
E get(int pos)
pos
- specifies which element to getIList<E> getSubList(int start, int stop)
start
- index of the first element of the sublist.stop
- stop - 1 is the index of the last element
of the sublist.int indexOf(E item)
item
- the element to search for in the list. item != nullint indexOf(E item, int pos)
item
- the element to search for in the list. Item != nullpos
- the position in the list to start searching fromvoid insert(int pos, E item)
pos
- the position to insert the data at in the listitem
- the data to add to the list, item != nullIterator<E> iterator()
void makeEmpty()
boolean remove(E obj)
obj
- The item to remove from this list. obj != nullE remove(int pos)
pos
- the position of the element to remove from the listvoid removeRange(int start, int stop)
start
- position at beginning of range of elements
to be removedstop
- stop - 1 is the position at the end
of the range of elements to be removedE set(int pos, E item)
pos
- the position in the list to overwriteitem
- the new item that will overwrite the old item,
item != nullint size()
String toString()