/** * Compares two words, mostly for the purpose of sorting words. * @param o1 the first word * @param o2 the second word * @return -1 if the first word is more similar to the misspelled word * <br>1 if the second word is more similar to the misspelled word * <br>0 if both words are equally similar * */ public int compare(Object o1, Object o2) { if (((Word) o1).getCost() < ((Word) o2).getCost()) return -1; if (((Word) o1).getCost() == ((Word) o2).getCost()) return 0; return 1; }
if (candidate.getCost() == bestScore) wordList.add(candidate);
for (Word suggestion : suggestions) { String suggestionString = suggestion.getWord(); int cost = suggestion.getCost();
for (Word suggestion : suggestions) { String suggestionString = suggestion.getWord(); int cost = suggestion.getCost();