< 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,1398 ****
capturingGroupCount = 1;
localCount = 0;
localTCNCount = 0;
// if length > 0, the Pattern is lazily compiled
! if (pattern.length() == 0) {
root = new Start(lastAccept);
matchRoot = lastAccept;
compiled = true;
}
}
--- 1388,1398 ----
capturingGroupCount = 1;
localCount = 0;
localTCNCount = 0;
// if length > 0, the Pattern is lazily compiled
! if (pattern.isEmpty()) {
root = new Start(lastAccept);
matchRoot = lastAccept;
compiled = true;
}
}
*** 1421,1431 ****
// Reset group index count
capturingGroupCount = 1;
localCount = 0;
localTCNCount = 0;
! if (pattern.length() > 0) {
compile();
} else {
root = new Start(lastAccept);
matchRoot = lastAccept;
}
--- 1421,1431 ----
// Reset group index count
capturingGroupCount = 1;
localCount = 0;
localTCNCount = 0;
! if (!pattern.isEmpty()) {
compile();
} else {
root = new Start(lastAccept);
matchRoot = lastAccept;
}
< prev index next >