T
- the element typepublic final class Sequence<T>
extends java.util.AbstractList<T>
implements java.util.List<T>, java.util.RandomAccess, java.io.Serializable
List
, it is in fact
immutable.Modifier and Type | Method and Description |
---|---|
<N> Sequence<N> |
cast(java.lang.Class<N> newType)
Cast a sequence to a different type if all the contained elements are of the subtype.
|
static <T> Sequence<T> |
empty()
Return an empty sequence.
|
boolean |
equals(java.lang.Object other)
Determine whether this sequence is equal to another.
|
boolean |
equals(Sequence<?> other)
Determine whether this sequence is equal to another.
|
T |
get(int index)
Get the value at a certain index.
|
int |
hashCode()
Get the hash code for this sequence.
|
boolean |
isEmpty()
Determine whether this sequence is empty.
|
java.util.Iterator<T> |
iterator()
Get an iterator over the elements of this sequence.
|
static <T> Sequence<T> |
of(java.util.Collection<T> members)
Return a sequence of the given members.
|
static <T> Sequence<T> |
of(T... members)
Return a sequence of the given members.
|
int |
size()
Return the number of elements in this sequence.
|
java.lang.Object[] |
toArray()
Get a copy of the values array.
|
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toString
public static <T> Sequence<T> of(T... members)
T
- the element typemembers
- the memberspublic static <T> Sequence<T> of(java.util.Collection<T> members)
T
- the element typemembers
- the memberspublic <N> Sequence<N> cast(java.lang.Class<N> newType) throws java.lang.ClassCastException
N
- the new typenewType
- the class to cast tojava.lang.ClassCastException
- if any elements could not be castpublic static <T> Sequence<T> empty()
T
- the element typepublic java.util.Iterator<T> iterator()
public int size()
public boolean isEmpty()
public java.lang.Object[] toArray()
public T get(int index)
public boolean equals(java.lang.Object other)
public boolean equals(Sequence<?> other)
other
- the other sequencetrue
if they are equal, false
otherwiseCopyright © 2010 JBoss, a division of Red Hat, Inc.