ChoiceMatch (Object hint) { ChoiceMatch ret = new ChoiceMatch(); if ((stringComparator != null) && (hint instanceof String strStart)) { int strLen = strStart.length(); int historyLen = shownHistory.size(); while (historyLen-- > 0) { Object content = shownHistory.get(historyLen); String str = content.toString(); int len = ChoiceMatch.getMatchingLength(strStart, str, stringComparator); if (((len > 0) && (len >= ret.len)) || (ret.len == 0)) { ret.content = content; ret.index = historyLen; ret.len = len; if ((len == strLen) && (str.length() == strLen)) { ret.exact = true; return ret; } } } } else { ret.index = shownHistory.indexOf(hint); if (ret.index != -1) { ret.exact = true; ret.content = hint; } } return ret; }