|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.infomancers.collections.iterators.Iterators
public final class Iterators
Utility class to create commonly used iterators.
| Constructor Summary | |
|---|---|
Iterators()
|
|
| Method Summary | ||
|---|---|---|
static
|
asList(java.lang.Iterable<T> iterable)
Used to get a List item from an iterable. |
|
static
|
deepenIterable(java.lang.Iterable<T> iterable,
Transformation<T,java.lang.Iterable<K>> transformation)
Used when a certain type T contains an iterable of items of type K. |
|
static
|
enumerationIterable(java.util.Enumeration<T> e)
Transforms an enumeration into an iterable, by yielding all the enumeration's items. |
|
static
|
filteredIterable(java.lang.Iterable<T> iterable,
Predicate<T> filter)
Used to create an iterable instance which yields only items answering a boolean query. |
|
static
|
loopIterable(java.lang.Iterable<T> iterable,
int times)
Used to create an iterable which loops over a different iterable. |
|
static
|
transformIterable(java.lang.Iterable<T> iterable,
Transformation<T,K> transformation)
Used to create an iterable instance which yields transformed items from an original iterable instance. |
|
static
|
uniqueIterable(java.lang.Iterable<T> iterable)
Used to iterate over only unique items from an already existing iteration. |
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Iterators()
| Method Detail |
|---|
public static <T> java.util.List<T> asList(java.lang.Iterable<T> iterable)
iterable - The iterable to convert to a List.
public static <T,K> java.lang.Iterable<K> deepenIterable(java.lang.Iterable<T> iterable,
Transformation<T,java.lang.Iterable<K>> transformation)
iterable - The original iterable instance.transformation - A transformation which returns the collection of K items
contained within the T item.
public static <T> java.lang.Iterable<T> enumerationIterable(java.util.Enumeration<T> e)
e - The enumeration.
public static <T> java.lang.Iterable<T> filteredIterable(java.lang.Iterable<T> iterable,
Predicate<T> filter)
iterable - The original iterable.filter - The predicate to use to filter items of the original iterable.
public static <T> java.lang.Iterable<T> loopIterable(java.lang.Iterable<T> iterable,
int times)
iterable - The original iterable.times - The amount of times to loop over the iterable, or 0 for
infinitely.
public static <T,K> java.lang.Iterable<K> transformIterable(java.lang.Iterable<T> iterable,
Transformation<T,K> transformation)
iterable - The original iterable instance.transformation - The transformation used on each element of the iterable instance.
public static <T> java.lang.Iterable<T> uniqueIterable(java.lang.Iterable<T> iterable)
iterable - The iteration to get only unique values from.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||