aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-10-21 15:10:07 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-21 15:10:07 +0000
commitd94645097a8aab6c44c6a20553f81954009dbc5b (patch)
tree8743018b4a2fe61f16943783f5b2331592e3a69d /java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
parent20ae86172e644b1aae97e0ea22c41433bd7ccc9e (diff)
parent46a007261fcbfbe887e22ecdf16307f95b1e4024 (diff)
downloadlatinime-d94645097a8aab6c44c6a20553f81954009dbc5b.tar.gz
latinime-d94645097a8aab6c44c6a20553f81954009dbc5b.tar.xz
latinime-d94645097a8aab6c44c6a20553f81954009dbc5b.zip
am 46a00726: Merge "Fix some compiler warnings"
* commit '46a007261fcbfbe887e22ecdf16307f95b1e4024': Fix some compiler warnings
Diffstat (limited to 'java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java')
-rw-r--r--java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
index 90a750493..d59b7a545 100644
--- a/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
+++ b/java/src/com/android/inputmethod/dictionarypack/UpdateHandler.java
@@ -59,6 +59,8 @@ import java.util.Locale;
import java.util.Set;
import java.util.TreeSet;
+import javax.annotation.Nullable;
+
/**
* Handler for the update process.
*
@@ -750,19 +752,22 @@ public final class UpdateHandler {
* @return an ordered list of runnables to be called to upgrade.
*/
private static ActionBatch compareMetadataForUpgrade(final Context context,
- final String clientId, List<WordListMetadata> from, List<WordListMetadata> to) {
+ final String clientId, @Nullable final List<WordListMetadata> from,
+ @Nullable final List<WordListMetadata> to) {
final ActionBatch actions = new ActionBatch();
// Upgrade existing word lists
DebugLogUtils.l("Comparing dictionaries");
final Set<String> wordListIds = new TreeSet<>();
// TODO: Can these be null?
- if (null == from) from = new ArrayList<>();
- if (null == to) to = new ArrayList<>();
- for (WordListMetadata wlData : from) wordListIds.add(wlData.mId);
- for (WordListMetadata wlData : to) wordListIds.add(wlData.mId);
+ final List<WordListMetadata> fromList = (from == null) ? new ArrayList<WordListMetadata>()
+ : from;
+ final List<WordListMetadata> toList = (to == null) ? new ArrayList<WordListMetadata>()
+ : to;
+ for (WordListMetadata wlData : fromList) wordListIds.add(wlData.mId);
+ for (WordListMetadata wlData : toList) wordListIds.add(wlData.mId);
for (String id : wordListIds) {
- final WordListMetadata currentInfo = MetadataHandler.findWordListById(from, id);
- final WordListMetadata metadataInfo = MetadataHandler.findWordListById(to, id);
+ final WordListMetadata currentInfo = MetadataHandler.findWordListById(fromList, id);
+ final WordListMetadata metadataInfo = MetadataHandler.findWordListById(toList, id);
// TODO: Remove the following unnecessary check, since we are now doing the filtering
// inside findWordListById.
final WordListMetadata newInfo = null == metadataInfo