All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aksw.commons.collections.IterableCollection Maven / Gradle / Ivy

There is a newer version: 0.9.9
Show newest version
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