code: public ParetoFront<T> trim(
  		final int size,
  		final ElementComparator<? super T> comparator,
  		final ElementDistance<? super T> distance,
  		final ToIntFunction<? super T> dimension
  	) {
  		requireNonNull(comparator);
  		requireNonNull(distance);
  		requireNonNull(dimension);
  
  		if (size() > size) {
  			final double[] distances = Pareto.crowdingDistance(
  				Seq.viewOf(_population),
  				comparator,
  				distance,
  				dimension
  			);
  
  			final List<T> list = IntStream.of(IndexSorter.sort(distances))
  				.limit(size)
  				.mapToObj(_population::get)
  				.collect(Collectors.toList());
  
  			_population.clear();
  			_population.addAll(list);
  		}
  
  		return this;
  	}
docs: Trims {@code this} pareto front to the given size. The front elements are
  sorted according its crowding distance and the elements which have smaller
  distance to its neighbors are removed first.
  
  <pre>{@code
  final ParetoFront<Vec<double[]>> front = new ParetoFront<>(Vec::dominance);
  front.trim(10, Vec::compare, Vec::distance, Vec::length);
  }</pre>
  The example above reduces the given front to 10 elements.
  
  @param size the number of front elements after the trim. If
  {@code size() <= size}, nothing is trimmed.
  @param comparator the element comparator used for calculating the
  crowded distance
  @param distance the element distance measure
  @param dimension the number of vector elements of {@code T}
  @return {@code this} trimmed pareto front
  @throws NullPointerException if one of the objects is {@code null}