javatools.datatypes
Class CombinedIterable<T>

java.lang.Object
  extended by javatools.datatypes.CombinedIterable<T>
All Implemented Interfaces:
java.io.Closeable, java.lang.Iterable<T>

public class CombinedIterable<T>
extends java.lang.Object
implements java.lang.Iterable<T>, java.io.Closeable

This class is part of the Java Tools (see http://mpii.de/yago-naga/javatools). It is licensed under the Creative Commons Attribution License (see http://creativecommons.org/licenses/by/3.0) by the YAGO-NAGA team (see http://mpii.de/yago-naga). The class combines multiple iterables to one iterable. This can be used in a for-each-loop.
Example:

         for(Object o : new CombinedIterable(list1,list2))
               process(o);
   


Constructor Summary
CombinedIterable()
          Creates an empty CombinedIterator
CombinedIterable(java.lang.Iterable<? extends T>... its)
          Creates a CombinedIterator from some iterators (may give a (useless) Java compiler warning)
CombinedIterable(java.lang.Iterable<? extends T> i1)
          Creates a CombinedIterator from one iterator
CombinedIterable(java.lang.Iterable<? extends T> i1, java.lang.Iterable<? extends T> i2)
          Creates a CombinedIterator two iterators
CombinedIterable(java.lang.Iterable<? extends T> i1, java.lang.Iterable<? extends T> i2, java.lang.Iterable<? extends T> i3)
          Creates a CombinedIterator three iterators
CombinedIterable(T i)
          Adds a set
 
Method Summary
 CombinedIterable<T> add(java.lang.Iterable<? extends T> i)
          Adds an iterable
 CombinedIterable<T> add(T i)
          Adds a value
 void close()
           
 java.util.Iterator<T> iterator()
          Returns this
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CombinedIterable

public CombinedIterable()
Creates an empty CombinedIterator


CombinedIterable

public CombinedIterable(java.lang.Iterable<? extends T> i1,
                        java.lang.Iterable<? extends T> i2)
Creates a CombinedIterator two iterators


CombinedIterable

public CombinedIterable(java.lang.Iterable<? extends T> i1)
Creates a CombinedIterator from one iterator


CombinedIterable

public CombinedIterable(java.lang.Iterable<? extends T> i1,
                        java.lang.Iterable<? extends T> i2,
                        java.lang.Iterable<? extends T> i3)
Creates a CombinedIterator three iterators


CombinedIterable

public CombinedIterable(T i)
Adds a set


CombinedIterable

public CombinedIterable(java.lang.Iterable<? extends T>... its)
Creates a CombinedIterator from some iterators (may give a (useless) Java compiler warning)

Method Detail

add

public CombinedIterable<T> add(java.lang.Iterable<? extends T> i)
Adds an iterable


add

public CombinedIterable<T> add(T i)
Adds a value


iterator

public java.util.Iterator<T> iterator()
Returns this

Specified by:
iterator in interface java.lang.Iterable<T>

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException