Skip to content

Commit 92684ef

Browse files
Victor RudometovPaul Hohensee
authored andcommitted
8301342: Prefer ArrayList to LinkedList in LayoutComparator
Backport-of: d67bfe21a23fea2d9ef4eef4e811b774cca2ab94
1 parent c4d91b7 commit 92684ef

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/java.desktop/share/classes/javax/swing/LayoutComparator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,8 @@
2424
*/
2525
package javax.swing;
2626

27+
import java.util.ArrayList;
2728
import java.util.Comparator;
28-
import java.util.LinkedList;
2929
import java.util.ListIterator;
3030
import java.awt.Component;
3131
import java.awt.ComponentOrientation;
@@ -63,7 +63,7 @@ public int compare(Component a, Component b) {
6363
// each Component and then search from the Window down until the
6464
// hierarchy branches.
6565
if (a.getParent() != b.getParent()) {
66-
LinkedList<Component> aAncestory = new LinkedList<Component>();
66+
ArrayList<Component> aAncestory = new ArrayList<>();
6767

6868
for(; a != null; a = a.getParent()) {
6969
aAncestory.add(a);
@@ -76,7 +76,7 @@ public int compare(Component a, Component b) {
7676
throw new ClassCastException();
7777
}
7878

79-
LinkedList<Component> bAncestory = new LinkedList<Component>();
79+
ArrayList<Component> bAncestory = new ArrayList<>();
8080

8181
for(; b != null; b = b.getParent()) {
8282
bAncestory.add(b);

0 commit comments

Comments
 (0)