Does anyone know the intention of this method? I'm
confused about the role 'end' has. It only affects the
method logic when end == start.

Many Thanks,
Janek

org.apache.commons.util.CollectionsUtils

    static public Collection slice(Collection coll,
int start, int end) {
        if(coll == null) {
            return null;
        }
        Iterator iterator = coll.iterator();
        Collection sub =
(Collection)ClassUtils.createObject(coll.getClass());
        end -= start;
        while(iterator.hasNext()) {
            if(start == 0) {
                if(end == 0) {
                    break;
                } else {
                    sub.add(iterator.next());
                }
            } else {
                iterator.next();   // ignore
                start--;
            }
        }
        return sub;
    }


__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to