Best style to iterate through two lists in unison

Here is what I just wrote:

 public void mutate(){
    ListIterator<Double> git = genome.listIterator();
    Iterator<Double> mit = mutationStrategies.iterator();
    while (git.hasNext() && mit.hasNext()){
        git.set(alleleUpdate(git.next(), mit.next()));
    }

}

Is this the most efficient and clear way to do this? All you need to know is that the list of genomes sets its values ​​according to some function that takes its current value and the current value of mutationStrategies. (If you are into evolutionary material, this is an algorithm for evolutionary strategies).

+5
source share
1 answer

It is hard to imagine how this could be tougher. "Replace each git (whatever it is) with a modified version of itself, stopping if we run out of mutation strategies."

+2

All Articles