< prev index next >
src/java.base/share/classes/java/net/HostPortrange.java
Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad
@@ -239,11 +239,11 @@
}
int[] parsePort(String port)
{
- if (port == null || port.equals("")) {
+ if (port == null || port.isEmpty()) {
return defaultPort();
}
if (port.equals("*")) {
return new int[] {PORT_MIN, PORT_MAX};
@@ -258,17 +258,17 @@
} else {
String low = port.substring(0, dash);
String high = port.substring(dash+1);
int l,h;
- if (low.equals("")) {
+ if (low.isEmpty()) {
l = PORT_MIN;
} else {
l = Integer.parseInt(low);
}
- if (high.equals("")) {
+ if (high.isEmpty()) {
h = PORT_MAX;
} else {
h = Integer.parseInt(high);
}
if (l < 0 || h < 0 || h<l) {
< prev index next >