java - I put data in a Map and I get it in different order -
i have method read data db, goes this:
public collection<map<string, string>> getallfieldsvalues() throws exception ... mapatemp.put("dni", dni.tostring()); mapatemp.put("nombre", nombre.tostring()); mapatemp.put("apellidos", apellidos.tostring()); mapatemp.put("curso", curso.tostring()); mapatemp.put("direccion", direccion.tostring()); allfieldsvalues.add(mapatemp); ... return allfieldsvalues;
then have method display data in jtable, problem read in different order put it, read in order. dni,direccion,nombre,apellidos,curso.
this problem because when display data in jtable appears in wrong order. knows why can be? thanks!
what type mapatemp , how read values map? example java hashmap has no order cannot expect results in insertion order.
you should looking @ linkedhashmap
Comments
Post a Comment