|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmondrian.util.UnionIterator<T>
public class UnionIterator<T>
Iterator over union of several Iterable collections.
Try, for instance, using the over(java.lang.Iterable extends T>...) helper method:
List<String> names;
List<String> addresses;
for (Sstring s : UnionIterator.over(names, addresses)) {
print(s);
}
| Constructor Summary | |
|---|---|
UnionIterator(Collection<? extends T>... iterables)
Creates a UnionIterator over a list of collections. |
|
UnionIterator(Iterable<? extends T>... iterables)
Creates a UnionIterator. |
|
| Method Summary | ||
|---|---|---|
boolean |
hasNext()
|
|
T |
next()
|
|
static
|
over(Collection<? extends T>... collections)
Returns the union of a list of collections. |
|
static
|
over(Iterable<? extends T>... iterables)
Returns the union of a list of iterables. |
|
void |
remove()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public UnionIterator(Iterable<? extends T>... iterables)
iterables - Array of iterablespublic UnionIterator(Collection<? extends T>... iterables)
iterables - Array of collections| Method Detail |
|---|
public boolean hasNext()
hasNext in interface Iterator<T>public T next()
next in interface Iterator<T>public void remove()
remove in interface Iterator<T>public static <T> Iterable<T> over(Iterable<? extends T>... iterables)
You can use it like this:
Iterable<String> iter1;
Iterable<String> iter2;
for (String s : union(iter1, iter2)) {
print(s);
}
iterables - Array of one or more iterables
public static <T> Iterable<T> over(Collection<? extends T>... collections)
This method exists for code that will be retrowoven to run on JDK 1.4.
Retroweaver has its own version of the Iterable interface, which
is problematic since the Collection classes don't
implement it. This method solves some of these problems by working in
terms of collections; retroweaver deals with these correctly.
collections - Array of one or more collections
over(Iterable[])
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||