[LANG-715] CharSetUtils.squeeze() speedup.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1144916 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2011-07-10 17:50:21 +00:00
parent a4f287acdb
commit 48920b44f0
1 changed files with 3 additions and 4 deletions

View File

@ -73,10 +73,9 @@ public class CharSetUtils {
char ch = ' ';
for (int i = 0; i < sz; i++) {
ch = chrs[i];
if (chars.contains(ch)) {
if ((ch == lastChar) && (i != 0)) {
continue;
}
// Compare with contains() last for performance.
if (ch == lastChar && i != 0 && chars.contains(ch)) {
continue;
}
buffer.append(ch);
lastChar = ch;