< prev index next >

src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()

@@ -188,11 +188,11 @@
     }
 
     @Override
     public HttpRequest.Builder method(String method, BodyPublisher body) {
         requireNonNull(method);
-        if (method.equals(""))
+        if (method.isEmpty())
             throw newIAE("illegal method <empty string>");
         if (method.equals("CONNECT"))
             throw newIAE("method CONNECT is not supported");
         if (!Utils.isValidName(method))
             throw newIAE("illegal method \""

@@ -203,11 +203,11 @@
         return method0(method, requireNonNull(body));
     }
 
     private HttpRequest.Builder method0(String method, BodyPublisher body) {
         assert method != null;
-        assert !method.equals("");
+        assert !method.isEmpty();
         this.method = method;
         this.bodyPublisher = body;
         return this;
     }
 
< prev index next >