Utilizzando la jvm 1.6 sono costretto ad utilizzare i generics.
Come si fa a trasformare questo pezzo di codice con i generics?
codice:
public static Vector getRoots() throws SQLException {
Vector ret = new Vector();
ResultSet resultSet = stat.executeQuery("SELECT * FROM DIR WHERE PARENT=0 ORDER BY LCASE(NAME)");
while (resultSet.next()) {
Hashtable hashtable = new Hashtable();
hashtable.put("key", resultSet.getString("key"));
hashtable.put("parent", resultSet.getString("parent"));
hashtable.put("name", resultSet.getString("name"));
hashtable.put("path", resultSet.getString("path"));
ret.add(hashtable);
}
return ret;
Ho provato varie volte ma non riesco.
Vector dovrebbe risolversi cosi:
Vector<String> vector = new Vector<String>();
non riesco a sistemare l'hashtable...
Grazie