|
XNIO API 3.0.4.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection<E> java.util.AbstractList<T> org.xnio.Sequence<T>
T
- the element typepublic final class Sequence<T>
An immutable sequence of elements. Though this class implements List
, it is in fact
immutable.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Method Summary | ||
---|---|---|
|
cast(Class<N> newType)
Cast a sequence to a different type if all the contained elements are of the subtype. |
|
static
|
empty()
Return an empty sequence. |
|
boolean |
equals(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. |
|
Iterator<T> |
iterator()
Get an iterator over the elements of this sequence. |
|
static
|
of(Collection<T> members)
Return a sequence of the given members. |
|
static
|
of(T... members)
Return a sequence of the given members. |
|
int |
size()
Return the number of elements in this sequence. |
|
Object[] |
toArray()
Get a copy of the values array. |
Methods inherited from class java.util.AbstractList |
---|
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, contains, containsAll, remove, removeAll, retainAll, toArray, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.List |
---|
add, add, addAll, addAll, clear, contains, containsAll, indexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray |
Method Detail |
---|
public static <T> Sequence<T> of(T... members)
T
- the element typemembers
- the members
public static <T> Sequence<T> of(Collection<T> members)
T
- the element typemembers
- the members
public <N> Sequence<N> cast(Class<N> newType) throws ClassCastException
N
- the new typenewType
- the class to cast to
ClassCastException
- if any elements could not be castpublic static <T> Sequence<T> empty()
T
- the element type
public Iterator<T> iterator()
iterator
in interface Iterable<T>
iterator
in interface Collection<T>
iterator
in interface List<T>
iterator
in class AbstractList<T>
public int size()
size
in interface Collection<T>
size
in interface List<T>
size
in class AbstractCollection<T>
public boolean isEmpty()
isEmpty
in interface Collection<T>
isEmpty
in interface List<T>
isEmpty
in class AbstractCollection<T>
true
if the sequence has no elementspublic Object[] toArray()
toArray
in interface Collection<T>
toArray
in interface List<T>
toArray
in class AbstractCollection<T>
public T get(int index)
get
in interface List<T>
get
in class AbstractList<T>
index
- the index
public boolean equals(Object other)
equals
in interface Collection<T>
equals
in interface List<T>
equals
in class AbstractList<T>
other
- the other sequence
true
if they are equal, false
otherwisepublic boolean equals(Sequence<?> other)
other
- the other sequence
true
if they are equal, false
otherwisepublic int hashCode()
hashCode
in interface Collection<T>
hashCode
in interface List<T>
hashCode
in class AbstractList<T>
|
XNIO API 3.0.4.GA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |