|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
T
- @Immutable public interface JImmutableList<T>
Interface for containers that store items in list form with individual items available for get() and assign() using their indexes. Items inserted into the list are always added at either the front or the end of the list and indexes of items are always in the range 0 through size() - 1.
Nested Class Summary | |
---|---|
static interface |
JImmutableList.Builder<T>
|
Method Summary | |
---|---|
JImmutableList<T> |
assign(int index,
T value)
Replaces the value at the specified index (which must be within current bounds of the list) with the new value. |
JImmutableList<T> |
deleteAll()
|
JImmutableList<T> |
deleteFirst()
Removes the first value from the list and reduces size by 1. |
JImmutableList<T> |
deleteLast()
Removes the last value from the list and reduces size by 1. |
T |
get(int index)
Retrieves the value at the specified index (which must be within the bounds of the list). |
List<T> |
getList()
Returns an unmodifiable List implementation backed by this list. |
JImmutableList<T> |
insert(Iterable<? extends T> values)
Adds the values to the end of the list in the same order they appear in the Iterable. |
JImmutableList<T> |
insert(T value)
Adds a value to the end of the list. |
JImmutableList<T> |
insertFirst(T value)
Adds a value to the front of the list. |
JImmutableList<T> |
insertLast(T value)
Adds a value to the end of the list. |
boolean |
isEmpty()
|
int |
size()
Retrieve the number of values available in the container. |
Methods inherited from interface org.javimmutable.collections.Cursorable |
---|
cursor |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
int size()
Indexed
size
in interface Indexed<T>
T get(int index)
get
in interface Indexed<T>
index
-
IndexOutOfBoundsException
- if index is out of bounds@Nonnull JImmutableList<T> assign(int index, @Nullable T value)
index
- value
-
IndexOutOfBoundsException
- if index is out of bounds@Nonnull JImmutableList<T> insert(@Nullable T value)
insert
in interface Insertable<T>
value
-
@Nonnull JImmutableList<T> insert(@Nonnull Iterable<? extends T> values)
values
-
@Nonnull JImmutableList<T> insertFirst(@Nullable T value)
value
-
@Nonnull JImmutableList<T> insertLast(@Nullable T value)
value
-
@Nonnull JImmutableList<T> deleteFirst()
IndexOutOfBoundsException
- if list is already empty@Nonnull JImmutableList<T> deleteLast()
IndexOutOfBoundsException
- if list is already emptyboolean isEmpty()
@Nonnull JImmutableList<T> deleteAll()
@Nonnull List<T> getList()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |