< prev index next >
src/java.base/share/classes/java/util/regex/Pattern.java
Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
@@ -1388,11 +1388,11 @@
capturingGroupCount = 1;
localCount = 0;
localTCNCount = 0;
// if length > 0, the Pattern is lazily compiled
- if (pattern.length() == 0) {
+ if (pattern.isEmpty()) {
root = new Start(lastAccept);
matchRoot = lastAccept;
compiled = true;
}
}
@@ -1421,11 +1421,11 @@
// Reset group index count
capturingGroupCount = 1;
localCount = 0;
localTCNCount = 0;
- if (pattern.length() > 0) {
+ if (!pattern.isEmpty()) {
compile();
} else {
root = new Start(lastAccept);
matchRoot = lastAccept;
}
< prev index next >