|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.molae.pipe.basic.PipeUtil
public final class PipeUtil
A collection of iterator related utility methods.
| Method Summary | ||
|---|---|---|
static void |
assertAssignableFrom(Iterator<?> it,
Class<?> cls)
Checks that all elements of the specified iterator are assignable to the specified class. |
|
static void |
assertIndexes(int fromIndex,
int toIndex,
int size)
Utility method for SubLists. |
|
static
|
getCardinalityMap(Iterator<E> it)
Returns a Map mapping each unique element in the given
Iterable to an Integer representing the number
of occurrences of that element in the Iterable. |
|
static
|
last(Iterator<E> it)
Iterates through an iterator to find its last element. |
|
static boolean |
removeAll(Iterator<?> it)
Removes all elements from the specified iterator. |
|
static int |
size(Iterator<?> it)
Counts all elments of an iterator. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int size(Iterator<?> it)
it - an Iterator object
public static <E> E last(Iterator<E> it)
it - an Iterator object
NoSuchElementException - if iterator is emptypublic static boolean removeAll(Iterator<?> it)
it - an Iterator object
true, if the iterator was not empty before.
UnsupportedOperationException - if the specified iterator
does not implement the remove method.
public static void assertAssignableFrom(Iterator<?> it,
Class<?> cls)
it - an Iterator objectcls - the intended element class of the iterator
ClassCastException, - if any element of the specified iterator
is not assignable to the specified class.
NullPointerException - if the specified Class parameter is
null.
public static void assertIndexes(int fromIndex,
int toIndex,
int size)
fromIndex - low endpoint (inclusive) of the subListtoIndex - high endpoint (exclusive) of the subListsize - size of the base list
IndexOutOfBoundsException - for an illegal endpoint index value
(fromIndex < 0 || toIndex > size || fromIndex > toIndex).public static <E> Map<E,Integer> getCardinalityMap(Iterator<E> it)
Map mapping each unique element in the given
Iterable to an Integer representing the number
of occurrences of that element in the Iterable.
Only those elements present in the iterable will appear as keys in the map.
it - the Iterable to get the cardinality map for,
must not be null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||