8272863: Replace usages of Collections.sort with List.sort call in public java modules

Reviewed-by: serb, dfuchs, naoto
This commit is contained in:
Andrey Turbanov 2021-08-26 20:47:02 +00:00 committed by Sergey Bylokhov
parent fe7d70886c
commit d732c3091f
10 changed files with 19 additions and 27 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,6 @@ package java.net;
import java.util.Map;
import java.util.List;
import java.util.Collections;
import java.util.Comparator;
import java.io.IOException;
import sun.util.logging.PlatformLogger;
@ -407,7 +406,7 @@ public class CookieManager extends CookieHandler
* path are distinguished by creation time (older first). Method made PP to enable testing.
*/
static List<String> sortByPathAndAge(List<HttpCookie> cookies) {
Collections.sort(cookies, new CookieComparator());
cookies.sort(new CookieComparator());
List<String> cookieHeader = new java.util.ArrayList<>();
for (HttpCookie cookie : cookies) {