< prev index next >
src/java.base/share/classes/javax/security/auth/callback/TextInputCallback.java
Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD
@@ -61,11 +61,11 @@
*
* @exception IllegalArgumentException if {@code prompt} is null
* or if {@code prompt} has a length of 0.
*/
public TextInputCallback(String prompt) {
- if (prompt == null || prompt.length() == 0)
+ if (prompt == null || prompt.isEmpty())
throw new IllegalArgumentException();
this.prompt = prompt;
}
/**
@@ -81,12 +81,12 @@
* if {@code prompt} has a length of 0,
* if {@code defaultText} is null
* or if {@code defaultText} has a length of 0.
*/
public TextInputCallback(String prompt, String defaultText) {
- if (prompt == null || prompt.length() == 0 ||
- defaultText == null || defaultText.length() == 0)
+ if (prompt == null || prompt.isEmpty() ||
+ defaultText == null || defaultText.isEmpty())
throw new IllegalArgumentException();
this.prompt = prompt;
this.defaultText = defaultText;
}
< prev index next >