|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<E>
edu.rice.cs.plt.collect.IterableCollection<E>
public class IterableCollection<E>
A Collection wrapping an Iterable. Allows iterables to be viewed as collections without creating a copy (which would require linear time). Does not support mutation, but does reflect changes made to the underlying iterable.
| Constructor Summary | |
|---|---|
IterableCollection(java.lang.Iterable<? extends E> iter)
|
|
| Method Summary | |
|---|---|
boolean |
add(E o)
|
boolean |
addAll(java.util.Collection<? extends E> c)
|
void |
clear()
|
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 |
contains(java.lang.Object o)
|
boolean |
equals(java.lang.Object o)
|
boolean |
hasFixedSize()
true if this iterable is known to have a fixed size. |
int |
hashCode()
|
boolean |
isEmpty()
Whether the iterable does not contain any elements. |
boolean |
isInfinite()
true if the iterable is known to have infinite size. |
boolean |
isStatic()
true if this iterable is unchanging. |
java.util.Iterator<E> |
iterator()
|
boolean |
remove(java.lang.Object o)
|
boolean |
removeAll(java.util.Collection<?> c)
|
boolean |
retainAll(java.util.Collection<?> c)
|
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. |
java.lang.String |
toString()
|
| Methods inherited from class java.util.AbstractCollection |
|---|
containsAll, toArray, toArray |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IterableCollection(java.lang.Iterable<? extends E> iter)
| Method Detail |
|---|
public int compositeHeight()
Composite
compositeHeight in interface Compositepublic int compositeSize()
Composite
compositeSize in interface Compositepublic boolean isEmpty()
SizedIterable
isEmpty in interface SizedIterable<E>isEmpty in interface java.util.Collection<E>isEmpty in class java.util.AbstractCollection<E>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<E>size in interface java.util.Collection<E>size in class java.util.AbstractCollection<E>public int size(int bound)
SizedIterablebound, bound is returned.
size in interface SizedIterable<E>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<E>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<E>public boolean isStatic()
SizedIterabletrue if this iterable is unchanging. This implies that hasFixedSize() is true, and that
iterator() will always return the same (either == or equal() and immutable) elements
in the same order. ("Immutable" here means that equals() invocations are consistent over time -- if
two objects are equal, they will never become inequal, and vice versa.)
isStatic in interface SizedIterable<E>public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<E>contains in class java.util.AbstractCollection<E>public java.util.Iterator<E> iterator()
iterator in interface java.lang.Iterable<E>iterator in interface java.util.Collection<E>iterator in class java.util.AbstractCollection<E>public boolean add(E o)
add in interface java.util.Collection<E>add in class java.util.AbstractCollection<E>public boolean addAll(java.util.Collection<? extends E> c)
addAll in interface java.util.Collection<E>addAll in class java.util.AbstractCollection<E>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<E>remove in class java.util.AbstractCollection<E>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<E>removeAll in class java.util.AbstractCollection<E>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<E>retainAll in class java.util.AbstractCollection<E>public void clear()
clear in interface java.util.Collection<E>clear in class java.util.AbstractCollection<E>public java.lang.String toString()
toString in class java.util.AbstractCollection<E>public boolean equals(java.lang.Object o)
equals in interface java.util.Collection<E>equals in class java.lang.Objectpublic int hashCode()
hashCode in interface java.util.Collection<E>hashCode in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||