|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.staccatocommons.collections.Lists
public class Lists
Class methods for dealing with List
| Constructor Summary | |
|---|---|
Lists()
|
|
| Method Summary | ||
|---|---|---|
static
|
addAfter(List<A> list,
A element,
A reference)
Inserts the given element after the reference. |
|
static
|
addBefore(List<A> list,
A element,
A reference)
Inserts the given element before the reference. |
|
static
|
first(List<A> list)
Retrieves the list first element (at position 0) |
|
static
|
from(A... elements)
Answers a new Unmodifiable list with the given elements. |
|
static
|
last(List<A> list)
Retrieves the last element (at position size - 1) |
|
static
|
removeLast(List<A> list)
Removes the list last element |
|
static
|
second(List<A> list)
Retrieves the list second element (at position 1) |
|
static
|
third(List<A> list)
Retrieves the list third element (at position 2) |
|
static
|
type()
Answers the List class, but preserving its element generic type. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Lists()
| Method Detail |
|---|
public static <A> void addAfter(@NonNull
List<A> list,
A element,
A reference)
NoSuchElementException if the list does not contain the reference
A - the list typelist - the listelement - the element to be inserted just afeter the reference elementreference - the reference. The list must contain it
public static <A> void addBefore(@NonNull
List<A> list,
A element,
A reference)
NoSuchElementException if the list does not contain the reference
A - the list typelist - the listelement - the element to be inserted just before the reference elementreference - the reference. The list must contain it
public static <A> A removeLast(@NonNull
List<A> list)
A - list -
public static <A> A first(@NotEmpty
List<A> list)
A - the list elements typelist -
IllegalArgumentException - if list is empty if list is empty is out of rangeList.get(int)
public static <A> A second(@MinSize(value=2)
List<A> list)
A - the list elements typelist -
IndexOutOfBoundsException - if index is out of rangeList.get(int)
public static <A> A third(@MinSize(value=3)
List<A> list)
A - the list elements typelist -
IndexOutOfBoundsException - if index is out of rangeList.get(int)
public static <A> A last(@NotEmpty
List<A> list)
A - the list elements typelist -
IndexOutOfBoundsException - if index is out of rangeList.get(int)@Constant public static <A> Class<List<A>> type()
A -
public static <A> List<A> from(A... elements)
Unmodifiable list with the given elements.
This method is not equivalent to Arrays.asList(Object...), which
answers mutable lists
A - elements -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||