I want as column key ordered but it did not work,There are other solutions!!
I need sorted colnnes to comaparer with a also hashmap sorte
public class AllRatingsOp {
public static void main(String[] args) throws ClassNotFoundException {
Table<Integer, Integer, Integer> table = HashBasedTable.create();
//List<Integer,Integer> lst1 = new List<Integer,Integer>();
Connection con = null;
Statement st = null;
ResultSet rs = null;
String url = "jdbc:mysql://localhost:3306/bd_recommandation";
String user = "root";
String password = "";
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection(url, user, password);
st = con.createStatement();
rs = st.executeQuery("SELECT * FROM vote order by id;");
while (rs.next()) {
Integer idoperateur = rs.getInt(1);//colomn 2
Integer id = rs.getInt(2);
Integer vote = rs.getInt(3);
table.put(idoperateur, id, vote);
}
System.out.println(table);
} catch (Exception e) {
}
}
i need your help thnx
You want a TreeBasedTable
instead of a HashBasedTable
:
Implementation of Table whose row keys and column keys are ordered by their natural ordering or by supplied comparators.