Bonjour,
j'ai encore un souci avec l'imbrication des boucles for,je croyais que c'était résolu depuis ma dernière discussion..
j'ai le code suivant:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
for (iter = product.values().iterator(); iter.hasNext();)
         { productID =((Integer)iter.next());
for (Iterator itr = clients.keySet().iterator(); itr.hasNext();) {
	aClientId = (Integer)itr.next();
	for (Iterator itr2 = clients.keySet().iterator(); itr2.hasNext();) {
		bClientId = (Integer)itr2.next();
		if (aClientId != bClientId) {
            rapp = getRapp(aClientId,bClientId);
            form = rapp*getNbr();
			System.out.println( aClientId+"|"+ productID+"|"+form);
		}
	}
}
on dirait que c'est une boucle infinie, ça m'affiche:
aClient1|product1|form
aClient1|product1|form
aClient1|product1|form
aClient2|product2|form
aClient2|product2|form
aClient3|product3|form
aClient3|product3|form
aClient3|product3|form
...............ça génère des millions de lignes

Normalement ça devrait afficher une seule valeur "form" par "aClient" et par "product", ça ne devrait pas se répéter.
et il doit y avoir finalement 10000 valeurs correspondant au nombre de aClient et de produits que j'ai dans mon fichier d'entrée.
Merci pour votre aide.