while (it.hasNext() && n <= MAX_HOSTS_RETURNED) {
while (it.hasNext() && n < MAX_HOSTS_RETURNED) {
    public synchronized Collection getHosts(String netName) {        GnutellaNet net = lookupNet(netName);        ArrayList res = new ArrayList(MAX_HOSTS_RETURNED);        HashMap map = net.getHosts();        ArrayList keys = new ArrayList(map.keySet());        Collections.shuffle(keys);        Iterator it = keys.iterator();        int n = 0;        while (it.hasNext() && n <= MAX_HOSTS_RETURNED) {            String key = (String)it.next();            res.add(map.get(key));            n++;        }        return res;    }