|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.chars.CharIterators
A class providing static methods and objects that do useful things with type-specific iterators.
Iterator
Method Summary | |
static CharIterator |
asCharIterator(Iterator i)
Wraps a standard list iterator into a type-specific list iterator. |
static CharListIterator |
asCharIterator(ListIterator i)
Wraps a standard iterator into a type-specific iterator. |
static CharIterator |
concat(CharIterator[] a)
Concatenates all iterators contained in an array. |
static CharIterator |
concat(CharIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
static CharListIterator |
fromTo(char from,
char to)
Creates a type-specific list iterator over an interval. |
static CharListIterator |
KEY_EMPTY_ITERATOR_METHOD()
Deprecated. As of fastutil 3.1, replaced by Iterators.EMPTY_ITERATOR . |
static CharList |
pour(CharIterator i)
Pours an iterator, returning a type-specific list. |
static int |
pour(CharIterator i,
CharCollection s)
Pours an iterator into a type-specific collection. |
static int |
pour(CharIterator i,
CharCollection s,
int max)
Pours an iterator into a type-specific collection, with a limit on the number of elements. |
static CharList |
pour(CharIterator i,
int max)
Pours an iterator, returning a type-specific list, with a limit on the number of elements. |
static char[] |
unwrap(CharIterator i)
Unwraps an iterator, returning an array. |
static int |
unwrap(CharIterator i,
char[] array)
Unwraps an iterator into an array. |
static int |
unwrap(CharIterator i,
char[] array,
int offset,
int max)
Unwraps an iterator into an array starting at a given offset for a given number of elements. |
static long |
unwrap(CharIterator i,
CharCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(CharIterator i,
CharCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static char[] |
unwrap(CharIterator i,
int max)
Unwraps an iterator, returning an array, with a limit on the number of elements. |
static CharListIterator |
wrap(char[] array)
Wraps the given array into a type-specific list iterator. |
static CharListIterator |
wrap(char[] array,
int offset,
int length)
Wraps the given part of an array into a type-specific list iterator. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static CharListIterator KEY_EMPTY_ITERATOR_METHOD()
fastutil
3.1, replaced by Iterators.EMPTY_ITERATOR
.
public static CharListIterator wrap(char[] array, int offset, int length)
The type-specific list iterator returned by this method will iterate
length
times, returning consecutive elements of the given
array starting from the one with index offset
.
array
- an array to wrap into a type-specific list iterator.offset
- the first element of the array to be returned.length
- the number of elements to return.public static CharListIterator wrap(char[] array)
The type-specific list iterator returned by this method will return all elements of the given array.
array
- an array to wrap into a type-specific list iterator.public static int unwrap(CharIterator i, char[] array, int offset, int max)
This method iterates over the given type-specific iterator and stores the elements
returned, up to a maximum of length
, in the given array starting at offset
.
The number of actually unwrapped elements is returned (it may be less than max
if
the iterator emits less than max
elements).
i
- a type-specific iterator.array
- an array to contain the output of the iterator.offset
- the first element of the array to be returned.max
- the maximum number of elements to unwrap.
public static int unwrap(CharIterator i, char[] array)
This method iterates over the given type-specific iterator and stores the elements returned in the given array. The iteration will stop when the iterator has no more elements or when the end of the array has been reached.
i
- a type-specific iterator.array
- an array to contain the output of the iterator.
public static char[] unwrap(CharIterator i, int max)
This method iterates over the given type-specific iterator and returns an array
containing the elements returned by the iterator. At most max
elements
will be returned.
i
- a type-specific iterator.max
- the maximum number of elements to be unwrapped.
public static char[] unwrap(CharIterator i)
This method iterates over the given type-specific iterator and returns an array containing the elements returned by the iterator.
i
- a type-specific iterator.
public static int unwrap(CharIterator i, CharCollection c, int max)
This method iterates over the given type-specific iterator and stores the elements
returned, up to a maximum of max
, in the given type-specific collection.
The number of actually unwrapped elements is returned (it may be less than max
if
the iterator emits less than max
elements).
i
- a type-specific iterator.c
- a type-specific collection array to contain the output of the iterator.max
- the maximum number of elements to unwrap.
public static long unwrap(CharIterator i, CharCollection c)
This method iterates over the given type-specific iterator and stores the elements returned in the given type-specific collection. The returned count on the number unwrapped elements is a long, so that it will work also with very large collections.
i
- a type-specific iterator.c
- a type-specific collection to contain the output of the iterator.
public static int pour(CharIterator i, CharCollection s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given collection (up to max
).
i
- a type-specific iterator.s
- a type-specific collection.max
- the maximum number of elements to be poured.
public static int pour(CharIterator i, CharCollection s)
This method iterates over the given type-specific iterator and adds the returned elements to the given collection.
i
- a type-specific iterator.s
- a type-specific collection.
public static CharList pour(CharIterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific list containing the returned elements (up to max
). Iteration
on the returned list is guaranteed to produce the elements in the same order
in which they appeared in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static CharList pour(CharIterator i)
This method iterates over the given type-specific iterator and returns a list containing the returned elements. Iteration on the returned list is guaranteed to produce the elements in the same order in which they appeared in the iterator.
i
- a type-specific iterator.
public static CharListIterator asCharIterator(ListIterator i)
This method wraps a standard iterator into a type-specific one which will handle the
type conversions for you. Of course, any attempt to wrap an iterator returning the
instances of the wrong class will generate a ClassCastException
. The
returned iterator is backed by i
: changes to one of the iterators
will affect the other, too.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static CharIterator asCharIterator(Iterator i)
This method wraps a standard list iterator into a type-specific one
which will handle the type conversions for you. Of course, any attempt
to wrap an iterator returning the instances of the wrong class will
generate a ClassCastException
. The
returned iterator is backed by i
: changes to one of the iterators
will affect the other, too.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- a list iterator.
i
.public static CharListIterator fromTo(char from, char to)
The type-specific list iterator returned by this method will return the
elements from
, from+1
,…, to-1
.
from
- the starting element (inclusive).to
- the ending element (exclusive).
from
to to
.public static CharIterator concat(CharIterator[] a)
This method returns an iterator that will enumerate in order the elements returned by all iterators contained in the given array.
a
- an array of iterators.
public static CharIterator concat(CharIterator[] a, int offset, int length)
This method returns an iterator that will enumerate in order the elements returned
by a[ offset ]
, then those returned
by a[ offset + 1 ]
, and so on up to
a[ offset + length - 1 ]
.
a
- an array of iterators.offset
- the index of the first iterator to concatenate.length
- the number of iterators to concatenate.
length
elements of a
starting at offset
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |