mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
textContains uses underlying char array
This commit is contained in:
@@ -83,8 +83,20 @@ public abstract class LeafElement extends TreeElement {
|
||||
|
||||
@Override
|
||||
public boolean textContains(char c) {
|
||||
CharSequence text = myText;
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
final CharSequence text = myText;
|
||||
final int len = myText.length();
|
||||
|
||||
if (len > TEXT_MATCHES_THRESHOLD) {
|
||||
char[] chars = CharArrayUtil.fromSequenceWithoutCopying(myText);
|
||||
if (chars != null) {
|
||||
for(int i = 0; i < chars.length; ++i) {
|
||||
if (chars[i] == c) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < len; ++i) {
|
||||
if (c == text.charAt(i)) return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user