package fr.synchrotron.soleil.ica.ci.service.multirepoproxy;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Gregory Boissinot
 */
public class RepositoryScanner {

    private List<RepositoryObject> repos = new ArrayList<RepositoryObject>();

    public RepositoryScanner(List<RepositoryObject> repoList) {
        if (repoList == null) {
            throw new NullPointerException("A list of repo is required.");
        }
        this.repos = repoList;
    }

    public boolean isLastRepo(int index) {
        return index == repos.size() - 1;
    }

    public RepositoryObject getRepoFromIndex(int index) {
        return repos.get(index);
    }

    public int getNextIndex(int index) {
        return ++index;
    }


}

@@ -547,23 +547,9 @@
  == 
-repos.size() - 
+-
 1;%0A 
@@ -705,18 +705,130 @@
     
-return ++i
+int nextIndex = ++index;%0A        if (nextIndex %3E repos.size() - 1) %7B%0A            return -1;%0A        %7D%0A        return nextI
 ndex

Fix last repo. Use a limit