> 2022年10月10日 01:07,Mark Thomas <ma...@apache.org> 写道:
> 
> On 08/10/2022 04:10, li...@apache.org <mailto:li...@apache.org> wrote:
>> This is an automated email from the ASF dual-hosted git repository.
>> lihan pushed a commit to branch main
>> in repository https://gitbox.apache.org/repos/asf/tomcat.git
>> The following commit(s) were added to refs/heads/main by this push:
>> new 52774c2467 Refactor. Simplify 'Map' operations. No functional change.
>> 52774c2467 is described below
>> commit 52774c24678f11ca7aadc02d98dca156e8c36b3d
>> Author: lihan <li...@apache.org>
>> AuthorDate: Sat Oct 8 11:10:30 2022 +0800
>> Refactor. Simplify 'Map' operations. No functional change.
>> ---
>> java/org/apache/catalina/connector/Request.java | 8 ++------
>> .../catalina/core/ApplicationPushBuilder.java | 8 +-------
>> java/org/apache/catalina/core/StandardContext.java | 23 
>> ++++++----------------
>> .../apache/catalina/servlets/WebdavServlet.java | 8 +-------
>> .../util/descriptor/web/SecurityConstraint.java | 8 ++------
>> java/org/apache/tomcat/util/http/Parameters.java | 7 +------
>> 6 files changed, 13 insertions(+), 49 deletions(-)
>> diff --git a/java/org/apache/catalina/connector/Request.java 
>> b/java/org/apache/catalina/connector/Request.java
>> index 40475e8fc5..b1f59767cc 100644
>> --- a/java/org/apache/catalina/connector/Request.java
>> +++ b/java/org/apache/catalina/connector/Request.java
>> @@ -3401,12 +3401,8 @@ public class Request implements HttpServletRequest {
>> for (AcceptLanguage acceptLanguage : acceptLanguages) {
>> // Add a new Locale to the list of Locales for this quality level
>> Double key = Double.valueOf(-acceptLanguage.getQuality()); // Reverse the 
>> order
>> - ArrayList<Locale> values = locales.get(key);
>> - if (values == null) {
>> - values = new ArrayList<>();
>> - locales.put(key, values);
>> - }
>> - values.add(acceptLanguage.getLocale());
>> + locales.computeIfAbsent(key, k -> new ArrayList<>())
>> + .add(acceptLanguage.getLocale());
> 
> It probably isn't documented anywhere apart from in an old post somewhere in 
> dev@ archives but these days we use 120 characters as the line length limit 
> for code. Comments (for reasons I forget that may not even be valid any more) 
> are usually limited to 80.
> 
> No need to amend these (but no objection either if you want to). Just 
> something to keep in mind for next time.
Done.

Thanks for your reminding. : )

Han

> 
> Mark
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org 
> <mailto:dev-unsubscr...@tomcat.apache.org>
> For additional commands, e-mail: dev-h...@tomcat.apache.org 
> <mailto:dev-h...@tomcat.apache.org>

Reply via email to