Bonjour à tous, je cherche a trier un array multidimensionnel.
Voici mon code:
Il me trie pas les membres par leurs noms, mais il mélange tous.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 final String[][] tab = new String [membresDao.count().getNombre()][2]; for(int i = 1; i < membresDao.count().getNombre()+1; i++){ //On fait notre recherche Membres noms = membresDao.find(i); tab[i-1][0] = noms.getNom()+" "+ noms.getPrenom(); // Noms tab[i-1][1] = noms.getPasse(); // Passe } Arrays.sort(tab[0]); // Le problème est ici for(String str[] : tab){ System.out.println(str[0]); nom.addItem(str[0]);}
Comment faire?
Partager