diff options
author | 2012-06-26 03:48:01 -0700 | |
---|---|---|
committer | 2012-06-26 03:48:01 -0700 | |
commit | 0131170da9ec8c36880b0c31bd066974150f341d (patch) | |
tree | da82f5a5b13bd491c04989a5df7c7c16dd2c132f /java/src | |
parent | 5d218bc029dae35133b3cec28b4df3197e490c3d (diff) | |
parent | 5953dc93cfe5eea3f03d439956d48d50fef990e3 (diff) | |
download | latinime-0131170da9ec8c36880b0c31bd066974150f341d.tar.gz latinime-0131170da9ec8c36880b0c31bd066974150f341d.tar.xz latinime-0131170da9ec8c36880b0c31bd066974150f341d.zip |
Merge "Avoid string conversions when possible."
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/Suggest.java | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java index 30da08e57..cb1ec8f7c 100644 --- a/java/src/com/android/inputmethod/latin/Suggest.java +++ b/java/src/com/android/inputmethod/latin/Suggest.java @@ -390,7 +390,7 @@ public class Suggest { int dataTypeForLog = dataType; final int prefMaxSuggestions = MAX_SUGGESTIONS; - final String word = wordInfo.mWord.toString(); + final CharSequence word = wordInfo.mWord; final int score = wordInfo.mScore; int pos = 0; @@ -413,7 +413,7 @@ public class Suggest { // Check the last one's score and bail if (suggestions.size() >= prefMaxSuggestions && suggestions.get(prefMaxSuggestions - 1).mScore >= score) return true; - final int length = word.codePointCount(0, word.length()); + final int length = Character.codePointCount(word, 0, word.length()); while (pos < suggestions.size()) { final int curScore = suggestions.get(pos).mScore; if (curScore < score @@ -429,9 +429,9 @@ public class Suggest { final StringBuilder sb = new StringBuilder(getApproxMaxWordLength()); if (mIsAllUpperCase) { - sb.append(word.toUpperCase(mLocale)); + sb.append(word.toString().toUpperCase(mLocale)); } else if (mIsFirstCharCapitalized) { - sb.append(StringUtils.toTitleCase(word, mLocale)); + sb.append(StringUtils.toTitleCase(word.toString(), mLocale)); } else { sb.append(word); } |