Interface ISimpleList
- Type Parameters:
-
T
- The type of elements in this list.
- All Known Implementing Classes:
-
NullUnlimitedList
,SimpleArrayList
public interface ISimpleList
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an element to the list at the specified index.void
Adds an element to the end of the list.get
(int index) Returns the element at the specified index.int
Returns the index of the first occurrence of the specified element in the list, or -1 if the list does not contain the element.boolean
isEmpty()
Returnstrue
if the list contains no elements, false otherwise.void
remove
(int index) Removes the element at the specified index.Replaces the element at the specified index with the specified element.int
size()
Returns the number of elements in the list.
-
Method Details
-
add
Adds an element to the end of the list.- Parameters:
-
element
- the element to add
-
add
Adds an element to the list at the specified index.- Parameters:
-
index
- the index at which to add the element -
element
- the element to add
-
get
Returns the element at the specified index.- Parameters:
-
index
- the index of the element to return - Returns:
- the element at the specified index
-
set
Replaces the element at the specified index with the specified element.- Parameters:
-
index
- the index of the element to replace -
element
- the element to be stored at the specified index - Returns:
- the element previously at the specified index
-
indexOf
Returns the index of the first occurrence of the specified element in the list, or -1 if the list does not contain the element.- Parameters:
-
element
- the element to search for - Returns:
- the index of the first occurrence of the specified element in the list, or -1 if the list does not contain the element
-
remove
void remove(int index) Removes the element at the specified index.- Parameters:
-
index
- the index of the element to be removed
-
size
int size()Returns the number of elements in the list.- Returns:
- the number of elements in the list
-
isEmpty
boolean isEmpty()Returnstrue
if the list contains no elements, false otherwise.- Returns:
-
true
if the list contains no elements, false otherwise
-