Consolidate SuggestedWords.getWordInfo and .getInfo
Change-Id: I959cf049f550b7be3ec002281ca7457e566b0214main
parent
34b8856077
commit
b5ac8ef586
|
@ -65,10 +65,6 @@ public final class SuggestedWords {
|
||||||
return mSuggestedWordInfoList.get(pos).mWord;
|
return mSuggestedWordInfoList.get(pos).mWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SuggestedWordInfo getWordInfo(int pos) {
|
|
||||||
return mSuggestedWordInfoList.get(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SuggestedWordInfo getInfo(int pos) {
|
public SuggestedWordInfo getInfo(int pos) {
|
||||||
return mSuggestedWordInfoList.get(pos);
|
return mSuggestedWordInfoList.get(pos);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +109,7 @@ public final class SuggestedWords {
|
||||||
alreadySeen.add(typedWord.toString());
|
alreadySeen.add(typedWord.toString());
|
||||||
final int previousSize = previousSuggestions.size();
|
final int previousSize = previousSuggestions.size();
|
||||||
for (int pos = 1; pos < previousSize; pos++) {
|
for (int pos = 1; pos < previousSize; pos++) {
|
||||||
final SuggestedWordInfo prevWordInfo = previousSuggestions.getWordInfo(pos);
|
final SuggestedWordInfo prevWordInfo = previousSuggestions.getInfo(pos);
|
||||||
final String prevWord = prevWordInfo.mWord;
|
final String prevWord = prevWordInfo.mWord;
|
||||||
// Filter out duplicate suggestion.
|
// Filter out duplicate suggestion.
|
||||||
if (!alreadySeen.contains(prevWord)) {
|
if (!alreadySeen.contains(prevWord)) {
|
||||||
|
|
|
@ -98,7 +98,7 @@ import java.util.Map;
|
||||||
jsonWriter.beginArray();
|
jsonWriter.beginArray();
|
||||||
final int size = words.size();
|
final int size = words.size();
|
||||||
for (int j = 0; j < size; j++) {
|
for (int j = 0; j < size; j++) {
|
||||||
final SuggestedWordInfo wordInfo = words.getWordInfo(j);
|
final SuggestedWordInfo wordInfo = words.getInfo(j);
|
||||||
jsonWriter.value(wordInfo.toString());
|
jsonWriter.value(wordInfo.toString());
|
||||||
}
|
}
|
||||||
jsonWriter.endArray();
|
jsonWriter.endArray();
|
||||||
|
|
Loading…
Reference in New Issue