How to define/implement this interface with generics in a simpler way?
<p>I'm working in a Genetic Algorithm and I want it as abstract as possible to be able to reuse the GA. I defined and implemented a Population Interface, and well it works, but I'm sure that's not the best way to do it. I don't have great experience with Java Generics. Is there an easier way of defining and implementing the Population interface (e.g. maybe avoid a cast conversion? avoid a new list in getChromosomes() ?)</p>

<pre><code>public interface Population
{
    void addChromosomes(List&lt;? extends Chromosome&gt; chromosomes);

    List&lt;Chromosome&gt; getChromosomes();

    // More code here ...
}

public class TSPPopulation implements Population
{
    private List&lt;TSPChromosome&gt; chromosomes;

    @Override
    public void addChromosomes(List&lt;? extends Chromosome&gt; chromosomes) {
        for (Chromosome chromosome : chromosomes) {
            this.chromosomes.add((TSPChromosome) chromosome);
        }
    }

    @Override
    public List&lt;Chromosome&gt; getChromosomes() {
        List&lt;Chromosome&gt; newList = new ArrayList&lt;Chromosome&gt;();
        for (TSPChromosome chromosome : chromosomes) {
            newList.add(chromosome);
        }
        return newList;
    }
}
</code></pre>
