@@ -549,7 +549,7 @@ public void clear() {
549549 }
550550
551551 private static class MultipleMethodMatcher implements MethodMatcher {
552- private Map <String , StaticRouterMatch > methods = new ConcurrentHashMap <>();
552+ private final Map <String , StaticRouterMatch > methods = new ConcurrentHashMap <>();
553553
554554 public MultipleMethodMatcher (SingleMethodMatcher matcher ) {
555555 methods .put (matcher .method , matcher .route );
@@ -696,7 +696,7 @@ Node insertRoute(String method, String pattern, Route route) {
696696
697697 while (true ) {
698698 // Handle key exhaustion
699- if (search .length () == 0 ) {
699+ if (search .isEmpty () ) {
700700 // Insert or update the node's leaf handler
701701 n .setEndpoint (method , route );
702702 return n ;
@@ -766,7 +766,7 @@ Node insertRoute(String method, String pattern, Route route) {
766766
767767 // If the new key is a subset, set the method/handler on this node and finish.
768768 search = search .substring (commonPrefix );
769- if (search .length () == 0 ) {
769+ if (search .isEmpty () ) {
770770 child .setEndpoint (method , route );
771771 return child ;
772772 }
@@ -940,7 +940,7 @@ Route findRoute(RouterMatch rctx, String method, Slice path) {
940940 case ntParam :
941941 case ntRegexp :
942942 // short-circuit and return no matching route for empty param values
943- if (xsearch .length () == 0 ) {
943+ if (xsearch .isEmpty () ) {
944944 continue ;
945945 }
946946 // serially loop through each node grouped by the tail delimiter
@@ -973,7 +973,7 @@ Route findRoute(RouterMatch rctx, String method, Slice path) {
973973 rctx .value (xsearch .substring (0 , p ).toString ());
974974 xsearch = xsearch .substring (p );
975975
976- if (xsearch .length () == 0 ) {
976+ if (xsearch .isEmpty () ) {
977977 if (xn .isLeaf ()) {
978978 Route h = xn .endpoints .get (method );
979979 if (h != null ) {
@@ -998,7 +998,7 @@ Route findRoute(RouterMatch rctx, String method, Slice path) {
998998 default :
999999 // catch-all nodes
10001000 // rctx.routeParams.Values = append(rctx.routeParams.Values, search)
1001- if (xsearch .length () > 0 ) {
1001+ if (! xsearch .isEmpty () ) {
10021002 rctx .value (xsearch .toString ());
10031003 }
10041004 xn = nds [0 ];
@@ -1164,7 +1164,7 @@ Segment patNextSegment(String pattern) {
11641164 // key = key.substring(0, idx);
11651165 }
11661166
1167- if (rexpat .length () > 0 ) {
1167+ if (! rexpat .isEmpty () ) {
11681168 if (rexpat .charAt (0 ) != '^' ) {
11691169 rexpat = "^" + rexpat ;
11701170 }
0 commit comments