while (it.hasNext() && n <= MAX_URLS_RETURNED) {
while (it.hasNext() && n < MAX_URLS_RETURNED) {
    public synchronized Collection getURLs(String netName, int protoVersion) {        GnutellaNet net = lookupNet(netName);        ArrayList res = new ArrayList(MAX_URLS_RETURNED);        HashMap map = net.getURLs();        ArrayList keys = new ArrayList(map.keySet());        Collections.shuffle(keys);        Iterator it = keys.iterator();        int n = 0;        while (it.hasNext() && n <= MAX_URLS_RETURNED) {            String key = (String)it.next();            RemoteURL url = (RemoteURL)map.get(key);            if (url.getProtoVersion() != protoVersion)                continue;            String cacheVersion = url.getCacheVersion();            if (cacheVersion.equals(RemoteURL.STATE_QUEUED))                continue;            if (cacheVersion.equals(RemoteURL.STATE_CHECKING))                continue;            if (cacheVersion.startsWith(RemoteURL.STATE_FAILED))                continue;            res.add(url);            n++;        }        return res;    }