code: @Override
      public int compareTo(DetectedLanguage o) {
          int compare = Double.compare(o.probability, this.probability);
          if (compare!=0) return compare;
          return this.locale.toString().compareTo(o.locale.toString());
      }
docs: See class header.