Originariamente inviato da mauroxxx83
Ho provato a modificare quest'altro pezzo di codice con i generics ma senza successo.
Così:
codice:
public static Hashtable<String,String> getPlaylists() throws SQLException {
        Hashtable<String,String> ret = new Hashtable<String,String>();
        ResultSet resultSet = stat.executeQuery("SELECT * FROM PLAYLIST ORDER BY KEY");
        while (resultSet.next()) {
            ret.put(resultSet.getString("name"), resultSet.getString("key"));
        }
        return ret;
    }
P.S.: Nel primo codice, vedi bene che il Vector l'ho fatto diventare: Vector<Hashtable<String,String>>
Se lo trovi scomodo o noioso, puoi definire una classe che estende quel tipo:

public class StringsHashVector extends Vector<Hashtable<String,String>> { }

anche senza nulla nel corpo (come minimo c'è il costruttore di default).

E quindi il tuo precedente codice diventa:

codice:
public static StringsHashVector getRoots() throws SQLException {
        StringsHashVector ret = new StringsHashVector();
.....
Più comodo, no?