Code example for Collection

Methods: size

0
    public CircularIterator(Collection collection) {
        this.collection = collection;
    } 
 
    public boolean hasNext() { 
        return collection.size() > 0;
    } 
 
    public Object next() {
        if (iterator == null || !iterator.hasNext())
            iterator = collection.iterator();
 
        return iterator.next();
    } 
 
    public void remove() { 
    } 
}