xxl.cursors
Class Iterators

java.lang.Object
  |
  +--xxl.cursors.Iterators

public abstract class Iterators
extends java.lang.Object

This class contains various methods for manipulating Iterators.


Constructor Summary
Iterators()
           
 
Method Summary
static int count(java.util.Iterator iterator)
          Counts the elements of a specified Iterator.
static java.lang.Object first(java.util.Iterator iterator)
          Returns the first element of an Iterator.
static void fray(java.util.Iterator iterator, java.util.Collection[] collections)
           
static java.lang.Object last(java.util.Iterator iterator)
          Returns the last element of an Iterator.
static java.lang.Object nth(java.util.Iterator iterator, int n)
          Returns the n-th element of an Iterator.
static void removeAll(java.util.Iterator iterator)
          Removes all elements of an Iterator.
static java.util.List split(java.util.Iterator iterator, java.util.Collection[] collections, Function function)
           
static void split(java.util.Iterator iterator, java.util.Collection[] collections, java.util.Iterator indices)
           
static java.lang.Object[] toArray(java.util.Iterator iterator)
          Converts an Iterator to an Array.
static java.lang.Object[] toArray(java.util.Iterator iterator, java.util.Iterator indices)
           
static java.lang.Object[] toArray(java.util.Iterator iterator, java.util.Iterator indices, java.lang.Object[] array)
           
static java.lang.Object[] toArray(java.util.Iterator iterator, java.lang.Object[] array)
           
static java.util.Collection toCollection(java.util.Iterator iterator, java.util.Collection collection)
          Adds the elements of an Iterator to a given Collection.
static java.util.List toList(java.util.Iterator iterator)
          Converts an Iterator to a List.
static void updateAll(Cursor cursor, Function function)
          Updates all elements of a Cursor with the result of a given Function.
static void updateAll(Cursor cursor, java.util.Iterator objects)
          Updates all elements of a Cursor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Iterators

public Iterators()
Method Detail

last

public static java.lang.Object last(java.util.Iterator iterator)
                             throws java.util.NoSuchElementException
Returns the last element of an Iterator.
Parameters:
iterator - input-Iterator
Returns:
the last element

nth

public static java.lang.Object nth(java.util.Iterator iterator,
                                   int n)
                            throws java.util.NoSuchElementException
Returns the n-th element of an Iterator.
Parameters:
iterator - input-Iterator
n - index of the element
Returns:
the n-th element

first

public static java.lang.Object first(java.util.Iterator iterator)
                              throws java.util.NoSuchElementException
Returns the first element of an Iterator.
Parameters:
iterator - input-Iterator
the - first element

count

public static int count(java.util.Iterator iterator)
Counts the elements of a specified Iterator.
Parameters:
iterator - input-Iterator
Returns:
the number of Elements

removeAll

public static void removeAll(java.util.Iterator iterator)
Removes all elements of an Iterator.
Parameters:
iterator - input-Iterator

updateAll

public static void updateAll(Cursor cursor,
                             java.util.Iterator objects)
Updates all elements of a Cursor.
Parameters:
cursor - input-Cursor
iterator - the Iterator with objects to be used for the update-operation

updateAll

public static void updateAll(Cursor cursor,
                             Function function)
Updates all elements of a Cursor with the result of a given Function.
Parameters:
cursor - input-Cursor
function - the Function used to compute the Object for the update-operation

toList

public static java.util.List toList(java.util.Iterator iterator)
Converts an Iterator to a List.
Parameters:
iterator - input-Iterator
Returns:
List of Iterator-elements

toCollection

public static java.util.Collection toCollection(java.util.Iterator iterator,
                                                java.util.Collection collection)
Adds the elements of an Iterator to a given Collection.
Parameters:
iterator - input-Iterator
collection - the Collection to which the elements are to be added
Returns:
collection

toArray

public static java.lang.Object[] toArray(java.util.Iterator iterator)
Converts an Iterator to an Array.
Parameters:
iterator - input-Iterator
Returns:
array of Iterator-elements

toArray

public static java.lang.Object[] toArray(java.util.Iterator iterator,
                                         java.util.Iterator indices)

toArray

public static java.lang.Object[] toArray(java.util.Iterator iterator,
                                         java.lang.Object[] array)

toArray

public static java.lang.Object[] toArray(java.util.Iterator iterator,
                                         java.util.Iterator indices,
                                         java.lang.Object[] array)

split

public static java.util.List split(java.util.Iterator iterator,
                                   java.util.Collection[] collections,
                                   Function function)

split

public static void split(java.util.Iterator iterator,
                         java.util.Collection[] collections,
                         java.util.Iterator indices)

fray

public static void fray(java.util.Iterator iterator,
                        java.util.Collection[] collections)