Java List Sort sortIfUnsorted(List genomes)

Here you can find the source of sortIfUnsorted(List genomes)

Description

sort If Unsorted

License

Apache License

Declaration

private static void sortIfUnsorted(List<Integer> genomes) 

Method Source Code

//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);
        }
    }
}

Related

  1. sortedInsert(List list, T item, Comparator comparator)
  2. sortedList(List list)
  3. sortedUnion(List args1, List args2)
  4. sortEntrySetToList(Set> set)
  5. sortIds(List ids)
  6. sortInputQueryKeys(List l)
  7. sortItems(List items, String putOnTop)
  8. sortList(ArrayList list)
  9. sortList(Collection list)