diff --git a/java/src/com/android/inputmethod/latin/SuggestedWords.java b/java/src/com/android/inputmethod/latin/SuggestedWords.java index 19967ef5e..82cfbbf17 100644 --- a/java/src/com/android/inputmethod/latin/SuggestedWords.java +++ b/java/src/com/android/inputmethod/latin/SuggestedWords.java @@ -85,7 +85,7 @@ public class SuggestedWords { final List wordList) { final ArrayList result = new ArrayList(); for (CharSequence word : wordList) { - if (null != word) result.add(new SuggestedWordInfo(word, null)); + if (null != word) result.add(new SuggestedWordInfo(word)); } return result; } @@ -94,7 +94,7 @@ public class SuggestedWords { final CompletionInfo[] infos) { final ArrayList result = new ArrayList(); for (CompletionInfo info : infos) { - if (null != info) result.add(new SuggestedWordInfo(info.getText(), null)); + if (null != info) result.add(new SuggestedWordInfo(info.getText())); } return result; } @@ -105,14 +105,14 @@ public class SuggestedWords { final CharSequence typedWord, final SuggestedWords previousSuggestions) { final ArrayList suggestionsList = new ArrayList(); final HashSet alreadySeen = new HashSet(); - suggestionsList.add(new SuggestedWordInfo(typedWord, null)); + suggestionsList.add(new SuggestedWordInfo(typedWord)); alreadySeen.add(typedWord.toString()); final int previousSize = previousSuggestions.size(); for (int pos = 1; pos < previousSize; pos++) { final String prevWord = previousSuggestions.getWord(pos).toString(); // Filter out duplicate suggestion. if (!alreadySeen.contains(prevWord)) { - suggestionsList.add(new SuggestedWordInfo(prevWord, null)); + suggestionsList.add(new SuggestedWordInfo(prevWord)); alreadySeen.add(prevWord); } } @@ -130,15 +130,12 @@ public class SuggestedWords { public SuggestedWordInfo(final CharSequence word, final CharSequence debugString) { mWord = word; + if (null == debugString) throw new NullPointerException(""); mDebugString = debugString; } public String getDebugString() { - if (mDebugString == null) { - return ""; - } else { - return mDebugString.toString(); - } + return mDebugString.toString(); } @Override