am 53f23234: Merge "[CS3.5] Small correction"

* commit '53f23234e31c9a569c7b30262cdf6bd123756aa9':
  [CS3.5] Small correction
This commit is contained in:
Jean Chalard 2014-06-24 09:40:39 +00:00 committed by Android Git Automerger
commit b6833ba585

View file

@ -336,16 +336,17 @@ public class SuggestedWords {
return; return;
} }
if (!TextUtils.isEmpty(typedWord)) { if (!TextUtils.isEmpty(typedWord)) {
removeSuggestedWordInfoFrom(typedWord, candidates, 0); removeSuggestedWordInfoFrom(typedWord, candidates, -1 /* startIndexExclusive */);
} }
for (int i = 0; i < candidates.size(); ++i) { for (int i = 0; i < candidates.size(); ++i) {
removeSuggestedWordInfoFrom(candidates.get(i).mWord, candidates, i); removeSuggestedWordInfoFrom(candidates.get(i).mWord, candidates,
i /* startIndexExclusive */);
} }
} }
private static void removeSuggestedWordInfoFrom(final String word, private static void removeSuggestedWordInfoFrom(final String word,
final ArrayList<SuggestedWordInfo> candidates, final int startIndex) { final ArrayList<SuggestedWordInfo> candidates, final int startIndexExclusive) {
for (int i = startIndex + 1; i < candidates.size(); ++i) { for (int i = startIndexExclusive + 1; i < candidates.size(); ++i) {
final SuggestedWordInfo previous = candidates.get(i); final SuggestedWordInfo previous = candidates.get(i);
if (word.equals(previous.mWord)) { if (word.equals(previous.mWord)) {
candidates.remove(i); candidates.remove(i);