|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.fastutil.Iterators
A class providing static methods that do useful things with type-specific iterators.
Iterator
Constructor Summary | |
Iterators()
|
Method Summary | |
static BooleanIterator |
asBooleanIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static ByteIterator |
asByteIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static CharIterator |
asCharIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static DoubleIterator |
asDoubleIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static FloatIterator |
asFloatIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static IntIterator |
asIntIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static LongIterator |
asLongIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static ObjectIterator |
asObjectIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static ShortIterator |
asShortIterator(Iterator i)
Wraps a standard iterator into a type-specific iterator. |
static BooleanIterator |
concat(BooleanIterator[] a)
Concatenates all iterators contained in an array. |
static BooleanIterator |
concat(BooleanIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
static ByteIterator |
concat(ByteIterator[] a)
Concatenates all iterators contained in an array. |
static ByteIterator |
concat(ByteIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
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 DoubleIterator |
concat(DoubleIterator[] a)
Concatenates all iterators contained in an array. |
static DoubleIterator |
concat(DoubleIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
static FloatIterator |
concat(FloatIterator[] a)
Concatenates all iterators contained in an array. |
static FloatIterator |
concat(FloatIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
static IntIterator |
concat(IntIterator[] a)
Concatenates all iterators contained in an array. |
static IntIterator |
concat(IntIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
static LongIterator |
concat(LongIterator[] a)
Concatenates all iterators contained in an array. |
static LongIterator |
concat(LongIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
static ObjectIterator |
concat(ObjectIterator[] a)
Concatenates all iterators contained in an array. |
static ObjectIterator |
concat(ObjectIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
static ShortIterator |
concat(ShortIterator[] a)
Concatenates all iterators contained in an array. |
static ShortIterator |
concat(ShortIterator[] a,
int offset,
int length)
Concatenates a sequence of iterators contained in an array. |
static BooleanListIterator |
emptyBooleanIterator()
Returns an empty type-specific list iterator. |
static ByteListIterator |
emptyByteIterator()
Returns an empty type-specific list iterator. |
static CharListIterator |
emptyCharIterator()
Returns an empty type-specific list iterator. |
static DoubleListIterator |
emptyDoubleIterator()
Returns an empty type-specific list iterator. |
static FloatListIterator |
emptyFloatIterator()
Returns an empty type-specific list iterator. |
static IntListIterator |
emptyIntIterator()
Returns an empty type-specific list iterator. |
static LongListIterator |
emptyLongIterator()
Returns an empty type-specific list iterator. |
static ObjectListIterator |
emptyObjectIterator()
Returns an empty type-specific list iterator. |
static ShortListIterator |
emptyShortIterator()
Returns an empty type-specific list iterator. |
static ByteBidirectionalIterator |
fromTo(byte from,
byte to)
Creates a type-specific bidirectional iterator over an interval. |
static CharBidirectionalIterator |
fromTo(char from,
char to)
Creates a type-specific bidirectional iterator over an interval. |
static IntBidirectionalIterator |
fromTo(int from,
int to)
Creates a type-specific bidirectional iterator over an interval. |
static LongBidirectionalIterator |
fromTo(long from,
long to)
Creates a type-specific bidirectional iterator over an interval. |
static ByteSet |
pour(ByteIterator i)
Pours an iterator, returning a type-specific set. |
static int |
pour(ByteIterator i,
ByteSet s)
Pours an iterator into a type-specific set. |
static int |
pour(ByteIterator i,
ByteSet s,
int max)
Pours an iterator into a type-specific set, with a limit on the number of elements. |
static ByteSet |
pour(ByteIterator i,
int max)
Pours an iterator, returning a type-specific set, with a limit on the number of elements. |
static CharSet |
pour(CharIterator i)
Pours an iterator, returning a type-specific set. |
static int |
pour(CharIterator i,
CharSet s)
Pours an iterator into a type-specific set. |
static int |
pour(CharIterator i,
CharSet s,
int max)
Pours an iterator into a type-specific set, with a limit on the number of elements. |
static CharSet |
pour(CharIterator i,
int max)
Pours an iterator, returning a type-specific set, with a limit on the number of elements. |
static DoubleSet |
pour(DoubleIterator i)
Pours an iterator, returning a type-specific set. |
static int |
pour(DoubleIterator i,
DoubleSet s)
Pours an iterator into a type-specific set. |
static int |
pour(DoubleIterator i,
DoubleSet s,
int max)
Pours an iterator into a type-specific set, with a limit on the number of elements. |
static DoubleSet |
pour(DoubleIterator i,
int max)
Pours an iterator, returning a type-specific set, with a limit on the number of elements. |
static FloatSet |
pour(FloatIterator i)
Pours an iterator, returning a type-specific set. |
static int |
pour(FloatIterator i,
FloatSet s)
Pours an iterator into a type-specific set. |
static int |
pour(FloatIterator i,
FloatSet s,
int max)
Pours an iterator into a type-specific set, with a limit on the number of elements. |
static FloatSet |
pour(FloatIterator i,
int max)
Pours an iterator, returning a type-specific set, with a limit on the number of elements. |
static IntSet |
pour(IntIterator i)
Pours an iterator, returning a type-specific set. |
static IntSet |
pour(IntIterator i,
int max)
Pours an iterator, returning a type-specific set, with a limit on the number of elements. |
static int |
pour(IntIterator i,
IntSet s)
Pours an iterator into a type-specific set. |
static int |
pour(IntIterator i,
IntSet s,
int max)
Pours an iterator into a type-specific set, with a limit on the number of elements. |
static ObjectSet |
pour(Iterator i)
Pours an iterator, returning a type-specific set. |
static ObjectSet |
pour(Iterator i,
int max)
Pours an iterator, returning a type-specific set, with a limit on the number of elements. |
static int |
pour(Iterator i,
ObjectSet s)
Pours an iterator into a type-specific set. |
static int |
pour(Iterator i,
ObjectSet s,
int max)
Pours an iterator into a type-specific set, with a limit on the number of elements. |
static LongSet |
pour(LongIterator i)
Pours an iterator, returning a type-specific set. |
static LongSet |
pour(LongIterator i,
int max)
Pours an iterator, returning a type-specific set, with a limit on the number of elements. |
static int |
pour(LongIterator i,
LongSet s)
Pours an iterator into a type-specific set. |
static int |
pour(LongIterator i,
LongSet s,
int max)
Pours an iterator into a type-specific set, with a limit on the number of elements. |
static ShortSet |
pour(ShortIterator i)
Pours an iterator, returning a type-specific set. |
static ShortSet |
pour(ShortIterator i,
int max)
Pours an iterator, returning a type-specific set, with a limit on the number of elements. |
static int |
pour(ShortIterator i,
ShortSet s)
Pours an iterator into a type-specific set. |
static int |
pour(ShortIterator i,
ShortSet s,
int max)
Pours an iterator into a type-specific set, with a limit on the number of elements. |
static boolean[] |
unwrap(BooleanIterator i)
Unwraps an iterator, returning an array. |
static int |
unwrap(BooleanIterator i,
boolean[] array)
Unwraps an iterator into an array. |
static int |
unwrap(BooleanIterator i,
boolean[] 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(BooleanIterator i,
BooleanCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(BooleanIterator i,
BooleanCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static boolean[] |
unwrap(BooleanIterator i,
int max)
Unwraps an iterator, returning an array, with a limit on the number of elements. |
static byte[] |
unwrap(ByteIterator i)
Unwraps an iterator, returning an array. |
static int |
unwrap(ByteIterator i,
byte[] array)
Unwraps an iterator into an array. |
static int |
unwrap(ByteIterator i,
byte[] 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(ByteIterator i,
ByteCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(ByteIterator i,
ByteCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static byte[] |
unwrap(ByteIterator i,
int max)
Unwraps an iterator, returning an array, 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 double[] |
unwrap(DoubleIterator i)
Unwraps an iterator, returning an array. |
static int |
unwrap(DoubleIterator i,
double[] array)
Unwraps an iterator into an array. |
static int |
unwrap(DoubleIterator i,
double[] 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(DoubleIterator i,
DoubleCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(DoubleIterator i,
DoubleCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static double[] |
unwrap(DoubleIterator i,
int max)
Unwraps an iterator, returning an array, with a limit on the number of elements. |
static float[] |
unwrap(FloatIterator i)
Unwraps an iterator, returning an array. |
static int |
unwrap(FloatIterator i,
float[] array)
Unwraps an iterator into an array. |
static int |
unwrap(FloatIterator i,
float[] 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(FloatIterator i,
FloatCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(FloatIterator i,
FloatCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static float[] |
unwrap(FloatIterator i,
int max)
Unwraps an iterator, returning an array, with a limit on the number of elements. |
static int[] |
unwrap(IntIterator i)
Unwraps an iterator, returning an array. |
static int[] |
unwrap(IntIterator i,
int max)
Unwraps an iterator, returning an array, with a limit on the number of elements. |
static int |
unwrap(IntIterator i,
int[] array)
Unwraps an iterator into an array. |
static int |
unwrap(IntIterator i,
int[] 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(IntIterator i,
IntCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(IntIterator i,
IntCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static Object[] |
unwrap(Iterator i)
Unwraps an iterator, returning an array. |
static Object[] |
unwrap(Iterator i,
int max)
Unwraps an iterator, returning an array, with a limit on the number of elements. |
static int |
unwrap(Iterator i,
Object[] array)
Unwraps an iterator into an array. |
static int |
unwrap(Iterator i,
Object[] 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(Iterator i,
ObjectCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(Iterator i,
ObjectCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static long[] |
unwrap(LongIterator i)
Unwraps an iterator, returning an array. |
static long[] |
unwrap(LongIterator i,
int max)
Unwraps an iterator, returning an array, with a limit on the number of elements. |
static int |
unwrap(LongIterator i,
long[] array)
Unwraps an iterator into an array. |
static int |
unwrap(LongIterator i,
long[] 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(LongIterator i,
LongCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(LongIterator i,
LongCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static short[] |
unwrap(ShortIterator i)
Unwraps an iterator, returning an array. |
static short[] |
unwrap(ShortIterator i,
int max)
Unwraps an iterator, returning an array, with a limit on the number of elements. |
static int |
unwrap(ShortIterator i,
short[] array)
Unwraps an iterator into an array. |
static int |
unwrap(ShortIterator i,
short[] 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(ShortIterator i,
ShortCollection c)
Unwraps an iterator into a type-specific collection. |
static int |
unwrap(ShortIterator i,
ShortCollection c,
int max)
Unwraps an iterator into a type-specific collection, with a limit on the number of elements. |
static BooleanListIterator |
wrap(boolean[] array)
Wraps the given array into a type-specific list iterator. |
static BooleanListIterator |
wrap(boolean[] array,
int offset,
int length)
Wraps the given part of an array into a type-specific list iterator. |
static ByteListIterator |
wrap(byte[] array)
Wraps the given array into a type-specific list iterator. |
static ByteListIterator |
wrap(byte[] array,
int offset,
int length)
Wraps the given part of an array into a type-specific list iterator. |
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. |
static DoubleListIterator |
wrap(double[] array)
Wraps the given array into a type-specific list iterator. |
static DoubleListIterator |
wrap(double[] array,
int offset,
int length)
Wraps the given part of an array into a type-specific list iterator. |
static FloatListIterator |
wrap(float[] array)
Wraps the given array into a type-specific list iterator. |
static FloatListIterator |
wrap(float[] array,
int offset,
int length)
Wraps the given part of an array into a type-specific list iterator. |
static IntListIterator |
wrap(int[] array)
Wraps the given array into a type-specific list iterator. |
static IntListIterator |
wrap(int[] array,
int offset,
int length)
Wraps the given part of an array into a type-specific list iterator. |
static LongListIterator |
wrap(long[] array)
Wraps the given array into a type-specific list iterator. |
static LongListIterator |
wrap(long[] array,
int offset,
int length)
Wraps the given part of an array into a type-specific list iterator. |
static ObjectListIterator |
wrap(Object[] array)
Wraps the given array into a type-specific list iterator. |
static ObjectListIterator |
wrap(Object[] array,
int offset,
int length)
Wraps the given part of an array into a type-specific list iterator. |
static ShortListIterator |
wrap(short[] array)
Wraps the given array into a type-specific list iterator. |
static ShortListIterator |
wrap(short[] 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 |
Constructor Detail |
public Iterators()
Method Detail |
public static BooleanListIterator emptyBooleanIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
public static BooleanListIterator wrap(boolean[] 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 BooleanListIterator wrap(boolean[] 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(BooleanIterator i, boolean[] 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(BooleanIterator i, boolean[] 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 boolean[] unwrap(BooleanIterator 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 boolean[] unwrap(BooleanIterator 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(BooleanIterator i, BooleanCollection 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(BooleanIterator i, BooleanCollection 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 BooleanIterator asBooleanIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static BooleanIterator concat(BooleanIterator[] 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 BooleanIterator concat(BooleanIterator[] 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
.public static ByteListIterator emptyByteIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
public static ByteListIterator wrap(byte[] 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 ByteListIterator wrap(byte[] 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(ByteIterator i, byte[] 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(ByteIterator i, byte[] 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 byte[] unwrap(ByteIterator 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 byte[] unwrap(ByteIterator 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(ByteIterator i, ByteCollection 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(ByteIterator i, ByteCollection 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(ByteIterator i, ByteSet s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given set (up to max
).
i
- a type-specific iterator.s
- a type-specific set.max
- the maximum number of elements to be poured.
public static int pour(ByteIterator i, ByteSet s)
This method iterates over the given type-specific iterator and adds the returned elements to the given set.
i
- a type-specific iterator.s
- a type-specific set.
public static ByteSet pour(ByteIterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific set containing the returned elements (up to max
). Iteration
on the returned set is guaranteed to produce the elements in the same order
in which they appeared first in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static ByteSet pour(ByteIterator i)
This method iterates over the given type-specific iterator and returns a set containing the returned elements. Iteration on the returned set is guaranteed to produce the elements in the same order in which they appeared first in the iterator.
i
- a type-specific iterator.
public static ByteIterator asByteIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static ByteBidirectionalIterator fromTo(byte from, byte to)
The type-specific bidirectional 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 ByteIterator concat(ByteIterator[] 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 ByteIterator concat(ByteIterator[] 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
.public static ShortListIterator emptyShortIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
public static ShortListIterator wrap(short[] 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 ShortListIterator wrap(short[] 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(ShortIterator i, short[] 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(ShortIterator i, short[] 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 short[] unwrap(ShortIterator 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 short[] unwrap(ShortIterator 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(ShortIterator i, ShortCollection 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(ShortIterator i, ShortCollection 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(ShortIterator i, ShortSet s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given set (up to max
).
i
- a type-specific iterator.s
- a type-specific set.max
- the maximum number of elements to be poured.
public static int pour(ShortIterator i, ShortSet s)
This method iterates over the given type-specific iterator and adds the returned elements to the given set.
i
- a type-specific iterator.s
- a type-specific set.
public static ShortSet pour(ShortIterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific set containing the returned elements (up to max
). Iteration
on the returned set is guaranteed to produce the elements in the same order
in which they appeared first in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static ShortSet pour(ShortIterator i)
This method iterates over the given type-specific iterator and returns a set containing the returned elements. Iteration on the returned set is guaranteed to produce the elements in the same order in which they appeared first in the iterator.
i
- a type-specific iterator.
public static ShortIterator asShortIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static ShortIterator concat(ShortIterator[] 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 ShortIterator concat(ShortIterator[] 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
.public static IntListIterator emptyIntIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
public static IntListIterator wrap(int[] 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 IntListIterator wrap(int[] 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(IntIterator i, int[] 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(IntIterator i, int[] 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 int[] unwrap(IntIterator 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 int[] unwrap(IntIterator 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(IntIterator i, IntCollection 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(IntIterator i, IntCollection 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(IntIterator i, IntSet s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given set (up to max
).
i
- a type-specific iterator.s
- a type-specific set.max
- the maximum number of elements to be poured.
public static int pour(IntIterator i, IntSet s)
This method iterates over the given type-specific iterator and adds the returned elements to the given set.
i
- a type-specific iterator.s
- a type-specific set.
public static IntSet pour(IntIterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific set containing the returned elements (up to max
). Iteration
on the returned set is guaranteed to produce the elements in the same order
in which they appeared first in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static IntSet pour(IntIterator i)
This method iterates over the given type-specific iterator and returns a set containing the returned elements. Iteration on the returned set is guaranteed to produce the elements in the same order in which they appeared first in the iterator.
i
- a type-specific iterator.
public static IntIterator asIntIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static IntBidirectionalIterator fromTo(int from, int to)
The type-specific bidirectional 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 IntIterator concat(IntIterator[] 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 IntIterator concat(IntIterator[] 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
.public static LongListIterator emptyLongIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
public static LongListIterator wrap(long[] 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 LongListIterator wrap(long[] 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(LongIterator i, long[] 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(LongIterator i, long[] 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 long[] unwrap(LongIterator 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 long[] unwrap(LongIterator 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(LongIterator i, LongCollection 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(LongIterator i, LongCollection 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(LongIterator i, LongSet s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given set (up to max
).
i
- a type-specific iterator.s
- a type-specific set.max
- the maximum number of elements to be poured.
public static int pour(LongIterator i, LongSet s)
This method iterates over the given type-specific iterator and adds the returned elements to the given set.
i
- a type-specific iterator.s
- a type-specific set.
public static LongSet pour(LongIterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific set containing the returned elements (up to max
). Iteration
on the returned set is guaranteed to produce the elements in the same order
in which they appeared first in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static LongSet pour(LongIterator i)
This method iterates over the given type-specific iterator and returns a set containing the returned elements. Iteration on the returned set is guaranteed to produce the elements in the same order in which they appeared first in the iterator.
i
- a type-specific iterator.
public static LongIterator asLongIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static LongBidirectionalIterator fromTo(long from, long to)
The type-specific bidirectional 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 LongIterator concat(LongIterator[] 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 LongIterator concat(LongIterator[] 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
.public static CharListIterator emptyCharIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
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, CharSet s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given set (up to max
).
i
- a type-specific iterator.s
- a type-specific set.max
- the maximum number of elements to be poured.
public static int pour(CharIterator i, CharSet s)
This method iterates over the given type-specific iterator and adds the returned elements to the given set.
i
- a type-specific iterator.s
- a type-specific set.
public static CharSet pour(CharIterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific set containing the returned elements (up to max
). Iteration
on the returned set is guaranteed to produce the elements in the same order
in which they appeared first in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static CharSet pour(CharIterator i)
This method iterates over the given type-specific iterator and returns a set containing the returned elements. Iteration on the returned set is guaranteed to produce the elements in the same order in which they appeared first in the iterator.
i
- a type-specific iterator.
public static CharIterator asCharIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static CharBidirectionalIterator fromTo(char from, char to)
The type-specific bidirectional 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
.public static FloatListIterator emptyFloatIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
public static FloatListIterator wrap(float[] 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 FloatListIterator wrap(float[] 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(FloatIterator i, float[] 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(FloatIterator i, float[] 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 float[] unwrap(FloatIterator 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 float[] unwrap(FloatIterator 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(FloatIterator i, FloatCollection 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(FloatIterator i, FloatCollection 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(FloatIterator i, FloatSet s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given set (up to max
).
i
- a type-specific iterator.s
- a type-specific set.max
- the maximum number of elements to be poured.
public static int pour(FloatIterator i, FloatSet s)
This method iterates over the given type-specific iterator and adds the returned elements to the given set.
i
- a type-specific iterator.s
- a type-specific set.
public static FloatSet pour(FloatIterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific set containing the returned elements (up to max
). Iteration
on the returned set is guaranteed to produce the elements in the same order
in which they appeared first in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static FloatSet pour(FloatIterator i)
This method iterates over the given type-specific iterator and returns a set containing the returned elements. Iteration on the returned set is guaranteed to produce the elements in the same order in which they appeared first in the iterator.
i
- a type-specific iterator.
public static FloatIterator asFloatIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static FloatIterator concat(FloatIterator[] 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 FloatIterator concat(FloatIterator[] 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
.public static DoubleListIterator emptyDoubleIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
public static DoubleListIterator wrap(double[] 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 DoubleListIterator wrap(double[] 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(DoubleIterator i, double[] 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(DoubleIterator i, double[] 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 double[] unwrap(DoubleIterator 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 double[] unwrap(DoubleIterator 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(DoubleIterator i, DoubleCollection 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(DoubleIterator i, DoubleCollection 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(DoubleIterator i, DoubleSet s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given set (up to max
).
i
- a type-specific iterator.s
- a type-specific set.max
- the maximum number of elements to be poured.
public static int pour(DoubleIterator i, DoubleSet s)
This method iterates over the given type-specific iterator and adds the returned elements to the given set.
i
- a type-specific iterator.s
- a type-specific set.
public static DoubleSet pour(DoubleIterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific set containing the returned elements (up to max
). Iteration
on the returned set is guaranteed to produce the elements in the same order
in which they appeared first in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static DoubleSet pour(DoubleIterator i)
This method iterates over the given type-specific iterator and returns a set containing the returned elements. Iteration on the returned set is guaranteed to produce the elements in the same order in which they appeared first in the iterator.
i
- a type-specific iterator.
public static DoubleIterator asDoubleIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static DoubleIterator concat(DoubleIterator[] 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 DoubleIterator concat(DoubleIterator[] 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
.public static ObjectListIterator emptyObjectIterator()
The iterator provided by this method returns no elements. The implementation uses the singleton pattern (i.e., it will always return the same instance), so it is very efficient.
public static ObjectListIterator wrap(Object[] 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 ObjectListIterator wrap(Object[] 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(Iterator i, Object[] 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(Iterator i, Object[] 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 Object[] unwrap(Iterator 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 Object[] unwrap(Iterator 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(Iterator i, ObjectCollection 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(Iterator i, ObjectCollection 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(Iterator i, ObjectSet s, int max)
This method iterates over the given type-specific iterator and adds
the returned elements to the given set (up to max
).
i
- a type-specific iterator.s
- a type-specific set.max
- the maximum number of elements to be poured.
public static int pour(Iterator i, ObjectSet s)
This method iterates over the given type-specific iterator and adds the returned elements to the given set.
i
- a type-specific iterator.s
- a type-specific set.
public static ObjectSet pour(Iterator i, int max)
This method iterates over the given type-specific iterator and returns
a type-specific set containing the returned elements (up to max
). Iteration
on the returned set is guaranteed to produce the elements in the same order
in which they appeared first in the iterator.
i
- a type-specific iterator.max
- the maximum number of elements to be poured.
max
.public static ObjectSet pour(Iterator i)
This method iterates over the given type-specific iterator and returns a set containing the returned elements. Iteration on the returned set is guaranteed to produce the elements in the same order in which they appeared first in the iterator.
i
- a type-specific iterator.
public static ObjectIterator asObjectIterator(Iterator 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
.
If i
is already type-specific, it will returned and no new object
will be generated.
i
- an iterator.
i
.public static ObjectIterator concat(ObjectIterator[] 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 ObjectIterator concat(ObjectIterator[] 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 |