Problème ordre d'affichage dans une map.
Bonjour;
je sais pas pourquoi si j'introduit mon map comme ceci
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
HashMap ma = new HashMap();
ma.put("Id ", "bbbb");
ma.put("Contact", "value");
Set set = ma.entrySet();
Iterator iterator = set.iterator();
String resultat = new String();
while (iterator.hasNext()) {
Entry entry = (Entry) iterator.next();
resultat+= (String) entry.getValue() ;
}
System.out.println(resultat); |
le résultat n'est pas dans le même ordre d'entrée. C'est à dire s'obtient
j'ai besoin de l'ordre dans mon application. Il y a quelqu'un qui a une idée SVP.
Merci.