package uk.ac.ebi.atlas.species.services;

import com.google.auto.value.AutoValue;

@AutoValue
abstract class PopularSpeciesInfo {
    static PopularSpeciesInfo create(String species, String kingdom, int baselineExperiments, int differentialExperiments) {
        return new AutoValue_PopularSpeciesInfo(species, kingdom, baselineExperiments + differentialExperiments, baselineExperiments, differentialExperiments);
    }

    abstract String species();
    abstract String kingdom();
    abstract int totalExperiments();
    abstract int baselineExperiments();
    abstract int differentialExperiments();
}

@@ -77,16 +77,46 @@
 Value;%0A%0A
+import java.util.Comparator;%0A%0A
 @AutoVal
@@ -628,11 +628,306 @@
 ments();
+%0A%0A    static Comparator%3CPopularSpeciesInfo%3E ReverseComparator = new Comparator%3CPopularSpeciesInfo%3E() %7B%0A        @Override%0A        public int compare(PopularSpeciesInfo o1, PopularSpeciesInfo o2) %7B%0A            return -Integer.compare(o1.totalExperiments(), o2.totalExperiments());%0A        %7D%0A    %7D;
 %0A%7D%0A

Add a Comparator instead of implementing Comparable We then can use this class with FluentIterable.toSortedList.