Here you can find the source of sortIfUnsorted(List
private static void sortIfUnsorted(List<Integer> genomes)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { private static void sortIfUnsorted(List<Integer> genomes) { int previous = Integer.MIN_VALUE; for (int i = 0; i < genomes.size(); i++) { if (genomes.get(i) < previous) { genomes.sort(null);/*from w ww . ja v a 2s .c om*/ return; } previous = genomes.get(i); } } }