code: @Override
      protected List<List<T>> mate(List<T> parent1,
                                   List<T> parent2,
                                   int numberOfCrossoverPoints,
                                   Random rng)
      {
          assert numberOfCrossoverPoints == 2 : "Expected number of cross-over points to be 2.";
  
          if (parent1.size() != parent2.size())
          {
              throw new IllegalArgumentException("Cannot perform cross-over with different length parents.");
          }
  
          List<T> offspring1 = new ArrayList<T>(parent1); // Use a random-access list for performance.
          List<T> offspring2 = new ArrayList<T>(parent2);
  
          int point1 = rng.nextInt(parent1.size());
          int point2 = rng.nextInt(parent1.size());
  
          int length = point2 - point1;
          if (length < 0)
          {
              length += parent1.size();
          }
  
          Map<T, T> mapping1 = new HashMap<T, T>(length * 2); // Big enough map to avoid re-hashing.
          Map<T, T> mapping2 = new HashMap<T, T>(length * 2);
          for (int i = 0; i < length; i++)
          {
              int index = (i + point1) % parent1.size();
              T item1 = offspring1.get(index);
              T item2 = offspring2.get(index);
              offspring1.set(index, item2);
              offspring2.set(index, item1);
              mapping1.put(item1, item2);
              mapping2.put(item2, item1);
          }
  
          checkUnmappedElements(offspring1, mapping2, point1, point2);
          checkUnmappedElements(offspring2, mapping1, point1, point2);
  
          List<List<T>> result = new ArrayList<List<T>>(2);
          result.add(offspring1);
          result.add(offspring2);
          return result;
      }
docs: {@inheritDoc}