@Nullable
  private Map.Entry<String, Double> detectLanguageCode(String text) {
    List<com.optimaize.langdetect.DetectedLanguage> lang = languageDetector.getProbabilities(text);
    // comment in for debugging:
    //System.out.println(languageDetector.getProbabilities(textObject));
    if (lang.size() > 0) {
      String code = lang.get(0).getLocale().getLanguage();
      double prob = lang.get(0).getProbability();
      return new AbstractMap.SimpleImmutableEntry<>(code, prob);
    } else {
      return null;
    }
  }
@ Nullable private Map . Entry < String , Double > detectLanguageCode ( String text ) { List < com . optimaize . langdetect . DetectedLanguage > lang = languageDetector . getProbabilities ( text ) ; if ( lang . size ( ) > 0 ) { String code = lang . get ( 0 ) . getLocale ( ) . getLanguage ( ) ; double prob = lang . get ( 0 ) . getProbability ( ) ; return new AbstractMap . SimpleImmutableEntry < > ( code , prob ) ; } else { return null ; } }
@return language or {@code null} if language could not be identified