am 69100329: Merge "Use an iterator to remove stuff from an ArrayList."

* commit '6910032972524541314249fb2a6c2202ac813845':
  Use an iterator to remove stuff from an ArrayList.
main
Jean Chalard 2013-06-06 01:24:35 -07:00 committed by Android Git Automerger
commit 323dd492f0
1 changed files with 7 additions and 4 deletions

View File

@ -30,6 +30,7 @@ import com.android.inputmethod.latin.makedict.UnsupportedFormatException;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Locale;
/**
@ -301,12 +302,14 @@ public class DictionaryInfoUtils {
private static void addOrUpdateDictInfo(final ArrayList<DictionaryInfo> dictList,
final DictionaryInfo newElement) {
for (final DictionaryInfo info : dictList) {
if (info.mLocale.equals(newElement.mLocale)) {
if (newElement.mVersion <= info.mVersion) {
final Iterator<DictionaryInfo> iter = dictList.iterator();
while (iter.hasNext()) {
final DictionaryInfo thisDictInfo = iter.next();
if (thisDictInfo.mLocale.equals(newElement.mLocale)) {
if (newElement.mVersion <= thisDictInfo.mVersion) {
return;
}
dictList.remove(info);
iter.remove();
}
}
dictList.add(newElement);