net.sf.javagimmicks.collections8.composite.CompositeCollection Maven / Gradle / Ivy
package net.sf.javagimmicks.collections8.composite;
import java.util.AbstractCollection;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
class CompositeCollection extends AbstractCollection
{
protected final List extends Collection> _collections;
CompositeCollection(final List extends Collection> collections)
{
_collections = collections;
}
@Override
public Iterator iterator()
{
return CompositeIterator.fromCollectionList(_collections);
}
@Override
public Spliterator spliterator()
{
return CompositeSpliterator.fromCollectionList(_collections);
}
@Override
public int size()
{
int result = 0;
for (final Collection c : _collections)
{
result += c.size();
}
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy