org.aksw.commons.collections.IterableCollection Maven / Gradle / Ivy
package org.aksw.commons.collections;
import com.google.common.collect.Iterables;
import java.util.AbstractCollection;
import java.util.Iterator;
/**
* A wrapper which makes an iterable appear as a collection.
*
* @author Claus Stadler
*/
public class IterableCollection
extends AbstractCollection
{
private Iterable iterable;
public static IterableCollection wrap(Iterable iterable)
{
return new IterableCollection(iterable);
}
public IterableCollection(Iterable iterable)
{
this.iterable = iterable;
}
@Override
public Iterator iterator()
{
return iterable.iterator();
}
@Override
public int size()
{
return Iterables.size(iterable);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy