package appeng.me.cache.helpers; import java.util.Collection; import java.util.Iterator; import appeng.parts.p2p.PartP2PTunnel; import appeng.util.iterators.NullIterator; public class TunnelCollection implements Iterable { final Class clz; Collection tunnelsource; public TunnelCollection(Collection src, Class c) { tunnelsource = src; clz = c; } @Override public Iterator iterator() { if ( tunnelsource == null ) return new NullIterator(); return new TunnelIterator( tunnelsource, clz ); } public void setSource(Collection c) { tunnelsource = c; } public boolean isEmpty() { return !iterator().hasNext(); } public boolean matches(Class c) { return clz == c; } public Class getClz() { return clz; } }