diff --git a/src/java.desktop/share/classes/javax/swing/LayoutComparator.java b/src/java.desktop/share/classes/javax/swing/LayoutComparator.java index 383e3755ae2..d81a9e7f439 100644 --- a/src/java.desktop/share/classes/javax/swing/LayoutComparator.java +++ b/src/java.desktop/share/classes/javax/swing/LayoutComparator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2023, 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 @@ -24,8 +24,8 @@ */ package javax.swing; +import java.util.ArrayList; import java.util.Comparator; -import java.util.LinkedList; import java.util.ListIterator; import java.awt.Component; import java.awt.ComponentOrientation; @@ -70,7 +70,7 @@ final class LayoutComparator implements Comparator, java.io.Serializa // each Component and then search from the Window down until the // hierarchy branches. if (a.getParent() != b.getParent()) { - LinkedList aAncestory = new LinkedList(); + ArrayList aAncestory = new ArrayList<>(); for(; a != null; a = a.getParent()) { aAncestory.add(a); @@ -83,7 +83,7 @@ final class LayoutComparator implements Comparator, java.io.Serializa throw new ClassCastException(); } - LinkedList bAncestory = new LinkedList(); + ArrayList bAncestory = new ArrayList<>(); for(; b != null; b = b.getParent()) { bAncestory.add(b);