--- old/src/share/classes/javax/swing/table/DefaultTableModel.java 2014-06-30 09:10:33.000000000 -0700 +++ new/src/share/classes/javax/swing/table/DefaultTableModel.java 2014-06-30 09:10:33.000000000 -0700 @@ -70,10 +70,10 @@ * The Vector of Vectors of * Object values. */ - protected Vector dataVector; + protected Vector> dataVector; /** The Vector of column identifiers. */ - protected Vector columnIdentifiers; + protected Vector columnIdentifiers; // // Constructors @@ -87,8 +87,8 @@ this(0, 0); } - private static Vector newVector(int size) { - Vector v = new Vector(size); + private static Vector newVector(int size) { + Vector v = new Vector<>(size); v.setSize(size); return v; } @@ -121,7 +121,7 @@ * @see #setDataVector * @see #setValueAt */ - public DefaultTableModel(Vector columnNames, int rowCount) { + public DefaultTableModel(Vector columnNames, int rowCount) { setDataVector(newVector(rowCount), columnNames); } @@ -156,7 +156,7 @@ * @see #getDataVector * @see #setDataVector */ - public DefaultTableModel(Vector data, Vector columnNames) { + public DefaultTableModel(Vector> data, Vector columnNames) { setDataVector(data, columnNames); } @@ -191,12 +191,12 @@ * @see #newRowsAdded * @see #setDataVector */ - public Vector getDataVector() { + public Vector> getDataVector() { return dataVector; } - private static Vector nonNullVector(Vector v) { - return (v != null) ? v : new Vector(); + private static Vector nonNullVector(Vector v) { + return (v != null) ? v : new Vector<>(); } /** @@ -219,7 +219,8 @@ * @param columnIdentifiers the names of the columns * @see #getDataVector */ - public void setDataVector(Vector dataVector, Vector columnIdentifiers) { + public void setDataVector(Vector> dataVector, + Vector columnIdentifiers) { this.dataVector = nonNullVector(dataVector); this.columnIdentifiers = nonNullVector(columnIdentifiers); justifyRows(0, getRowCount()); @@ -264,7 +265,7 @@ for (int i = from; i < to; i++) { if (dataVector.elementAt(i) == null) { - dataVector.setElementAt(new Vector(), i); + dataVector.setElementAt(new Vector<>(), i); } ((Vector)dataVector.elementAt(i)).setSize(getColumnCount()); } @@ -347,7 +348,7 @@ * * @param rowData optional data of the row being added */ - public void addRow(Vector rowData) { + public void addRow(Vector rowData) { insertRow(getRowCount(), rowData); } @@ -371,7 +372,7 @@ * @param rowData optional data of the row being added * @exception ArrayIndexOutOfBoundsException if the row was invalid */ - public void insertRow(int row, Vector rowData) { + public void insertRow(int row, Vector rowData) { dataVector.insertElementAt(rowData, row); justifyRows(row, row+1); fireTableRowsInserted(row, row); @@ -394,13 +395,13 @@ return (j == 0) ? i : gcd(j, i%j); } - private static void rotate(Vector v, int a, int b, int shift) { + private static void rotate(Vector v, int a, int b, int shift) { int size = b - a; int r = size - shift; int g = gcd(size, r); for(int i = 0; i < g; i++) { int to = i; - Object tmp = v.elementAt(a + to); + E tmp = v.elementAt(a + to); for(int from = (to + r) % size; from != i; from = (to + r) % size) { v.setElementAt(v.elementAt(a + from), a + to); to = from; @@ -481,7 +482,7 @@ * to zero columns * @see #setNumRows */ - public void setColumnIdentifiers(Vector columnIdentifiers) { + public void setColumnIdentifiers(Vector columnIdentifiers) { setDataVector(dataVector, columnIdentifiers); } @@ -531,7 +532,7 @@ * @param columnName the identifier of the column being added */ public void addColumn(Object columnName) { - addColumn(columnName, (Vector)null); + addColumn(columnName, (Vector)null); } /** @@ -547,7 +548,7 @@ * @param columnName the identifier of the column being added * @param columnData optional data of the column being added */ - public void addColumn(Object columnName, Vector columnData) { + public void addColumn(Object columnName, Vector columnData) { columnIdentifiers.addElement(columnName); if (columnData != null) { int columnSize = columnData.size(); @@ -557,7 +558,7 @@ justifyRows(0, getRowCount()); int newColumn = getColumnCount() - 1; for(int i = 0; i < columnSize; i++) { - Vector row = (Vector)dataVector.elementAt(i); + Vector row = dataVector.elementAt(i); row.setElementAt(columnData.elementAt(i), newColumn); } } @@ -646,7 +647,7 @@ * column was given */ public Object getValueAt(int row, int column) { - Vector rowVector = (Vector)dataVector.elementAt(row); + Vector rowVector = dataVector.elementAt(row); return rowVector.elementAt(column); } @@ -662,7 +663,7 @@ * column was given */ public void setValueAt(Object aValue, int row, int column) { - Vector rowVector = (Vector)dataVector.elementAt(row); + Vector rowVector = dataVector.elementAt(row); rowVector.setElementAt(aValue, column); fireTableCellUpdated(row, column); } @@ -677,11 +678,11 @@ * @return the new vector; if anArray is null, * returns null */ - protected static Vector convertToVector(Object[] anArray) { + protected static Vector convertToVector(Object[] anArray) { if (anArray == null) { return null; } - Vector v = new Vector(anArray.length); + Vector v = new Vector<>(anArray.length); for (Object o : anArray) { v.addElement(o); } @@ -694,11 +695,11 @@ * @return the new vector of vectors; if anArray is * null, returns null */ - protected static Vector convertToVector(Object[][] anArray) { + protected static Vector> convertToVector(Object[][] anArray) { if (anArray == null) { return null; } - Vector v = new Vector(anArray.length); + Vector> v = new Vector<>(anArray.length); for (Object[] o : anArray) { v.addElement(convertToVector(o)); }