From 123407261cdab5d3eced0b18eaa7a1d59d6ae887 Mon Sep 17 00:00:00 2001 From: Jean Chalard Date: Thu, 15 Mar 2012 14:37:40 +0900 Subject: [PATCH] Stop meaningless explicit null passing Change-Id: I6950897d262f610d502b7f8293b9dd8d2b53e6e8 --- .../android/inputmethod/latin/SuggestedWords.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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