E
- the type of elements in this listpublic interface IList<E>
Modifier and Type | Method and Description |
---|---|
boolean |
add(E e)
Appends the specified element to the end of this list.
|
void |
add(int index,
E e)
Inserts the specified element at the specified position in this list.
|
void |
clear()
Removes all of the elements from this list.
|
boolean |
contains(java.lang.Object o)
Returns true if this list contains the specified element.
|
E |
get(int index)
Returns the element at the specified position in this list.
|
int |
indexOf(java.lang.Object o)
Returns the index of the first occurrence of the specified element in
this list, or -1 if this list does not contain the element.
|
boolean |
isEmpty() |
int |
lastIndexOf(java.lang.Object o)
Returns the index of the last occurrence of the specified element in this list, or -1 if
this list does not contain the element.
|
E |
remove(int index)
Removes the element at the specified position in this list.
|
boolean |
remove(java.lang.Object o)
Removes the first occurrence of the specified element from this list, if it is present.
|
void |
removeRange(int fromIndex,
int toIndex)
Removes from this list all of the elements whose index is between fromIndex,
inclusive, and toIndex, exclusive.
|
E |
set(int index,
E e) |
int |
size() |
boolean add(E e)
e
- element to be appended to this listCollection.add(Object)
void add(int index, E e)
index
- index at which the specified element is to be insertede
- element to be insertedjava.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index > size())
boolean remove(java.lang.Object o)
o
- element to be removed from this list, if presentE remove(int index)
index
- the index of the element to be removedjava.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())
void removeRange(int fromIndex, int toIndex)
(toIndex - fromIndex)
elements.
(If toIndex==fromIndex
, this operation has no effect.)fromIndex
- index of first element to be removedtoIndex
- index after last element to be removedjava.lang.IndexOutOfBoundsException
- if fromIndex or toIndex is out of range:
fromIndex < 0 || fromIndex >= size() ||
toIndex > size() || toIndex < fromIndex
E get(int index)
index
- index of the element to returnjava.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())
E set(int index, E e)
index
- index of the element to replacee
- element to be stored at the specified positionjava.lang.IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= size())
boolean contains(java.lang.Object o)
(o==null ? e==null : o.equals(e))
.o
- element whose presence in this list is to be testedint indexOf(java.lang.Object o)
(o==null ? get(i)==null : o.equals(get(i)))
, or -1
if there is no such index.o
- element to search forint lastIndexOf(java.lang.Object o)
(o==null ? get(i)==null : o.equals(get(i)))
, or -1
if there is no such index.o
- element to search forvoid clear()
int size()
boolean isEmpty()