package net.caspervg.jgaf.step;

import net.caspervg.jgaf.Arguments;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Provides a way to mutate an organism
 *
 * @param <O> Type of the organism
 */
@FunctionalInterface
public interface Mutator<O> {

    /**
     * Mutates a single organism
     *
     * @param arguments Arguments to use for the mutation
     * @param child Child to mutate
     * @return Mutated child
     */
    O mutate(Arguments arguments, O child);

    /**
     * Mutates a list of organisms
     *
     * @param arguments Arguments to use for the mutation
     * @param children Children to mutate
     * @return Mutated organisms
     */
    default List<O> mutate(Arguments arguments, List<O> children) {
        return children.stream().map(child -> mutate(arguments, child)).collect(Collectors.toList());
    }
}

@@ -63,16 +63,45 @@
 ments;%0A%0A
+import java.util.Collection;%0A
 import j
@@ -717,20 +717,26 @@
 default 
-List
+Collection
 %3CO%3E muta
@@ -759,20 +759,26 @@
 uments, 
-List
+Collection
 %3CO%3E chil

Use Collection for Mutator parameters and return value