JDK Version:1.2beta3-J
OS: Solaris
Locale:
On Solaris, JDKversion 1.2beta3-J, List add(String) method is much slower
than previous version, such as jdk1.1.3.
==============================CheckList.java===============================
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class CheckList implements ActionListener {
Button button;
List list;
public static void main(String args[]) {
new CheckList();
}
public CheckList() {
Frame f = new Frame("Check List");
f.setLayout(new BorderLayout());
button = new Button("Remove All");
button.addActionListener(this);
list = new List(20);
for (int i = 0; i < 800; i ++) {
list.add("My number is " + i);
}
f.add("North", button);
f.add("South", list);
f.pack();
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (list.getItemCount() > 0) {
list.removeAll();
list.invalidate();
button.setLabel("Add Items");
} else {
for (int i = 0; i < 800; i ++) {
list.add("My number is " + i);
}
button.setLabel("Remove All");
}
}
}
jim.hu@prc 1998-03-05
This bug still exists in JDK1.2beta3-L.
jim.hu@prc 1998-03-12
OS: Solaris
Locale:
On Solaris, JDKversion 1.2beta3-J, List add(String) method is much slower
than previous version, such as jdk1.1.3.
==============================CheckList.java===============================
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class CheckList implements ActionListener {
Button button;
List list;
public static void main(String args[]) {
new CheckList();
}
public CheckList() {
Frame f = new Frame("Check List");
f.setLayout(new BorderLayout());
button = new Button("Remove All");
button.addActionListener(this);
list = new List(20);
for (int i = 0; i < 800; i ++) {
list.add("My number is " + i);
}
f.add("North", button);
f.add("South", list);
f.pack();
f.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (list.getItemCount() > 0) {
list.removeAll();
list.invalidate();
button.setLabel("Add Items");
} else {
for (int i = 0; i < 800; i ++) {
list.add("My number is " + i);
}
button.setLabel("Remove All");
}
}
}
jim.hu@prc 1998-03-05
This bug still exists in JDK1.2beta3-L.
jim.hu@prc 1998-03-12