T - public interface EList<T> extends List<T>
EList is an extension of the Java Collections List interface designed to allow for easy use and manipulation.
It implements convenience methods, and defines new methods analagous to the Java Collections operations to support a fluid, or chainable, interface.
Convenience methods defined by EList:
Methods that redefine standard Collection and List methods to support method call chaining:
addItems(Object...)#addItems(Collection...)insertItems(int, Object...)#insertItems(int, Collection...)removeItems(Object...)#removeItems(Collection...)retainItems(Object...)#retainItems(Collection...)Expressive.list(Object...),
Expressive#list(Collection...)| Modifier and Type | Method and Description |
|---|---|
EList<T> |
addItems(Collection<? extends T> collection)
Appends all of the elements in the specific collections onto the end of this list.
|
EList<T> |
addItems(T... values)
Appends all of the specified elements onto the end of this list.
|
T |
at(int index)
Returns the element at the given index, or null if the element does not
exist.
|
EList<T> |
duplicate()
Creates a copy of this
EList containing the same elements. |
T |
first()
Returns the first element of this list, or null if none exists.
|
EList<T> |
getItems(EPredicate<T> predicate) |
EList<T> |
getItems(int index,
int size)
Returns a list of the items from the given index for the given size.
|
EList<T> |
insertItems(int index,
Collection<? extends T> values)
Inserts all of the elements in the specified collections of elements into
this list at the specified position.
|
EList<T> |
insertItems(int index,
T... values)
Inserts all of the elements in the specified elements into this list at
the specified position.
|
T |
last()
Returns the last element of this list, or null if none exists.
|
EList<T> |
removeItems(Collection<? extends T> values)
Removes from this list all of the elements in the specified collections.
|
EList<T> |
removeItems(EPredicate<T> predicate) |
EList<T> |
removeItems(T... values)
Removes from this list all of the specified elements.
|
EList<T> |
retainItems(Collection<? extends T> values)
Retains only the elements in this list that are contained in the
specified collections.
|
EList<T> |
retainItems(EPredicate<T> predicate) |
EList<T> |
retainItems(T... values)
Retains only the elements in this list that are specified.
|
EList<T> |
sort(Comparator<T> comparator)
Sorts this
EList in place using the given comparator. |
Pair<EList<T>,EList<T>> |
split(EPredicate<T> predicate) |
EList<T> |
subList(int fromIndex,
int toIndex)
Redefines
List.subList(int, int) to return an EList |
T first()
T last()
T at(int index)
index - EList<T> insertItems(int index, T... values)
index - index at which to insert the first element from the specified
collectionvalues - element(s) to be added to this listIndexOutOfBoundsException - if the index is out of range ( index < 0 || index > size())EList<T> insertItems(int index, Collection<? extends T> values)
index - index at which to insert the first element from the specified
collectionvalues - collections containing the element(s) to be added to this listIndexOutOfBoundsException - if the index is out of range ( index < 0 || index > size())EList<T> addItems(T... values)
values - element(s) to be appended to this listEList<T> addItems(Collection<? extends T> collection)
Appends all of the elements in the specific collections onto the end of this list.
The new elements will appear in this list in the order that the collections they reside in specify.
values - element(s) to be appended to this listEList<T> removeItems(T... values)
values - the elements to be removed from this listEList<T> removeItems(Collection<? extends T> values)
values - collections containing the elements to be removed from this
listEList<T> removeItems(EPredicate<T> predicate)
EList<T> retainItems(T... values)
values - List.retainAll(Collection)EList<T> retainItems(Collection<? extends T> values)
values - List.retainAll(Collection)EList<T> retainItems(EPredicate<T> predicate)
EList<T> duplicate()
EList containing the same elements.EList<T> subList(int fromIndex, int toIndex)
List.subList(int, int) to return an EListsubList in interface List<T>List.subList(int, int)EList<T> getItems(int index, int size)
EList<String> list = Expressive.list("A","B","C");
EList<String> items = list.getItems(-2,3);
assertThat(items.size(), is(1));
assertThat(items, is(list("A")));
index - size - EList<T> getItems(EPredicate<T> predicate)
EList<T> sort(Comparator<T> comparator)
EList in place using the given comparator.comparator - Collections.sort(List)Copyright © 2013 Atomic Leopard. All Rights Reserved.