Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import java.io.File;
import java.net.URI;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Locale;
import java.util.Objects;
Expand Down Expand Up @@ -1300,23 +1301,23 @@ void addItem(final File directory) {

// create File instances of each directory leading up to the top
File f = directory.getAbsoluteFile();
final Vector<File> path = new Vector<File>(10);
final ArrayList<File> path = new ArrayList<File>(10);
while (f.getParent() != null) {
path.addElement(f);
path.add(f);
f = getFileChooser().getFileSystemView().createFileObject(f.getParent());
};

// Add root file (the desktop) to the model
final File[] roots = getFileChooser().getFileSystemView().getRoots();
for (final File element : roots) {
path.addElement(element);
path.add(element);
}
fPathCount = path.size();

// insert all the path fDirectories leading up to the
// selected directory in reverse order (current directory at top)
for (int i = 0; i < path.size(); i++) {
fDirectories.addElement(path.elementAt(i));
fDirectories.addElement(path.get(i));
}

setSelectedItem(fDirectories.elementAt(0));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
Expand Down Expand Up @@ -212,7 +212,7 @@ public String getFileName() {
directoryList : fileList;
Object[] files = list.getSelectedValues();
int len = files.length;
Vector<String> result = new Vector<String>(len + 1);
ArrayList<String> result = new ArrayList<String>(len + 1);

// we return all selected file names
for (int i = 0; i < len; i++) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
Expand Down Expand Up @@ -1050,9 +1050,9 @@ private void addItem(File directory) {
File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
: canonical;
File f = sf;
Vector<File> path = new Vector<File>(10);
ArrayList<File> path = new ArrayList<File>(10);
do {
path.addElement(f);
path.add(f);
} while ((f = f.getParentFile()) != null);

int pathCount = path.size();
Expand Down
14 changes: 7 additions & 7 deletions src/java.desktop/share/classes/sun/awt/PlatformFont.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
Expand All @@ -26,8 +26,8 @@
package sun.awt;

import java.awt.peer.FontPeer;
import java.util.ArrayList;
import java.util.Locale;
import java.util.Vector;
import sun.font.SunFontManager;
import sun.java2d.FontSupport;
import java.nio.CharBuffer;
Expand Down Expand Up @@ -143,7 +143,7 @@ public CharsetString[] makeMultiCharsetString(char[] str, int offset, int len,
if (len < 1) {
return new CharsetString[0];
}
Vector<CharsetString> mcs = null;
ArrayList<CharsetString> mcs = null;
char[] tmpStr = new char[len];
char tmpChar = defaultChar;
boolean encoded = false;
Expand Down Expand Up @@ -198,10 +198,10 @@ public CharsetString[] makeMultiCharsetString(char[] str, int offset, int len,
}
if (currentFont != fd){
if (mcs == null) {
mcs = new Vector<>(3);
mcs = new ArrayList<>(3);
}
mcs.addElement(new CharsetString(tmpStr, lastIndex,
i-lastIndex, currentFont));
mcs.add(new CharsetString(tmpStr, lastIndex,
i-lastIndex, currentFont));
currentFont = fd;
fd = defaultFont;
lastIndex = i;
Expand All @@ -214,7 +214,7 @@ public CharsetString[] makeMultiCharsetString(char[] str, int offset, int len,
result = new CharsetString[1];
result[0] = cs;
} else {
mcs.addElement(cs);
mcs.add(cs);
result = mcs.toArray(new CharsetString[mcs.size()]);
}
return result;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
Expand Down Expand Up @@ -789,9 +789,9 @@ public void addItem(File directory) {
File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
: canonical;
File f = sf;
Vector<File> path = new Vector<File>(10);
ArrayList<File> path = new ArrayList<File>(10);
do {
path.addElement(f);
path.add(f);
} while ((f = f.getParentFile()) != null);

int pathCount = path.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;
import java.util.Vector;
Expand Down Expand Up @@ -1139,9 +1140,9 @@ private void addItem(File directory) {
File sf = useShellFolder ? ShellFolder.getShellFolder(canonical)
: canonical;
File f = sf;
Vector<File> path = new Vector<File>(10);
ArrayList<File> path = new ArrayList<File>(10);
do {
path.addElement(f);
path.add(f);
} while ((f = f.getParentFile()) != null);

int pathCount = path.size();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import java.awt.image.ColorModel;
import java.awt.peer.WindowPeer;
import java.util.ArrayList;
import java.util.Vector;

import sun.awt.windows.WWindowPeer;
import sun.java2d.SunGraphicsEnvironment;
Expand Down Expand Up @@ -214,30 +213,30 @@ public GraphicsConfiguration[] getConfigurations() {

int max = getMaxConfigs(screen);
int defaultPixID = getDefaultPixID(screen);
Vector<GraphicsConfiguration> v = new Vector<>( max );
ArrayList<GraphicsConfiguration> v = new ArrayList<>( max );
if (defaultPixID == 0) {
// Workaround for failing GDI calls
defaultConfig = Win32GraphicsConfig.getConfig(this,
defaultPixID);
v.addElement(defaultConfig);
v.add(defaultConfig);
}
else {
for (int i = 1; i <= max; i++) {
if (isPixFmtSupported(i, screen)) {
if (i == defaultPixID) {
defaultConfig = Win32GraphicsConfig.getConfig(
this, i);
v.addElement(defaultConfig);
v.add(defaultConfig);
}
else {
v.addElement(Win32GraphicsConfig.getConfig(
v.add(Win32GraphicsConfig.getConfig(
this, i));
}
}
}
}
configs = new GraphicsConfiguration[v.size()];
v.copyInto(configs);
v.toArray(configs);
}
return configs.clone();
}
Expand Down