|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.plt.iter.AbstractIterable<T>
edu.rice.cs.plt.iter.MappedIterable<S,T>
S - The element type of the original listT - The element type of the transformed listpublic class MappedIterable<S,T>
An Iterable containing all the values in the provided Iterable after applying some specified transformation.
| Constructor Summary | |
|---|---|
MappedIterable(java.lang.Iterable<? extends S> source,
Lambda<? super S,? extends T> map)
|
|
| Method Summary | ||
|---|---|---|
int |
compositeHeight()
Get the maximum path length from this node to a leaf. |
|
int |
compositeSize()
Get the number of nodes in the tree rooted at this node. |
|
boolean |
hasFixedSize()
true if this iterable is known to have a fixed size. |
|
boolean |
isEmpty()
Whether the iterable does not contain any elements. |
|
boolean |
isInfinite()
true if the iterable is known to have infinite size. |
|
boolean |
isStatic()
Always false: results of a lambda may be arbitrary. |
|
MappedIterator<S,T> |
iterator()
|
|
T |
last()
Get the last element of the list. |
|
static
|
make(java.lang.Iterable<? extends S> source,
Lambda<? super S,? extends T> map)
Call the constructor (allows the type arguments to be inferred) |
|
static
|
makeSnapshot(java.lang.Iterable<? extends S> source,
Lambda<? super S,? extends T> map)
Create a MappedIterable and wrap it in a SnapshotIterable, forcing
immediate evaluation of the mapping. |
|
int |
size()
Compute the number of elements in the iterable. |
|
int |
size(int bound)
Compute the number of elements in the iterable, up to the given bound. |
|
| Methods inherited from class edu.rice.cs.plt.iter.AbstractIterable |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MappedIterable(java.lang.Iterable<? extends S> source,
Lambda<? super S,? extends T> map)
| Method Detail |
|---|
public int compositeHeight()
Composite
compositeHeight in interface Compositepublic int compositeSize()
Composite
compositeSize in interface Compositepublic MappedIterator<S,T> iterator()
iterator in interface java.lang.Iterable<T>public boolean isEmpty()
SizedIterable
isEmpty in interface SizedIterable<T>public int size()
SizedIterableint, Integer.MAX_VALUE should be returned. Otherwise, next() may be safely invoked
on the iterator exactly this number of times.
size in interface SizedIterable<T>public int size(int bound)
SizedIterablebound, bound is returned.
size in interface SizedIterable<T>bound - Maximum result. Assumed to be nonnegative.public boolean isInfinite()
SizedIterabletrue if the iterable is known to have infinite size. If true, an iterator over the iterable in its
current state will never return false from hasNext().
isInfinite in interface SizedIterable<T>public boolean hasFixedSize()
SizedIterabletrue if this iterable is known to have a fixed size. This is the case if the iterable is immutable,
or if changes can only replace values, not remove or add them. An infinite iterable may be fixed if it
is guaranteed to never become finite.
hasFixedSize in interface SizedIterable<T>public boolean isStatic()
isStatic in interface SizedIterable<T>public T last()
OptimizedLastIterable
last in interface OptimizedLastIterable<T>
public static <S,T> MappedIterable<S,T> make(java.lang.Iterable<? extends S> source,
Lambda<? super S,? extends T> map)
public static <S,T> SnapshotIterable<T> makeSnapshot(java.lang.Iterable<? extends S> source,
Lambda<? super S,? extends T> map)
MappedIterable and wrap it in a SnapshotIterable, forcing
immediate evaluation of the mapping.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||