-
Notifications
You must be signed in to change notification settings - Fork 38.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use List#isEmpty()
in DispatcherServlet
#31244
Conversation
DispatcherServlet
Hi @shin-mallang,
That method is intentionally
Good catch. I've repurposed this PR to focus on that and have changed the title accordingly. |
@sbrannen I have one question. Is there any advantage to doing it in this way other than it reveals the intent of the method is utility? I'm just curious as to the reasoning behind doing it this way. |
You're very welcome.
Yes
The rationale is two-fold:
|
Thank you for your kind answer.🙇🏻♂️ |
There was no reason for getRequestUri() to be static, so we removed it.
If the reason the method is static is because it does not access state from the instance, then I think there are several more candidates for static.
Based on this, I think that static in
getRequestUri()
is unnecessary.And, all the methods in
DispatcherServlet
usedisEmpty()
, and only one part usedsize() > 0
.I changed this to
isEmpty()
for uniformity.