Bonjour
je voulais optimiser mon code sur l'objet "sgn" qui se cré dans ma boucle à chaque fois .
merci!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 chrono.start(); //je veux rendre le chrono minimal (durée de la boucle actuelle 5s) for(TimedEvent e : log){ for(Iterator itMap = map.entrySet().iterator(); itMap.hasNext();){ Map.Entry eMap = (Map.Entry)itMap.next(); param = Integer.parseInt(eMap.getValue().toString()); if(e.signature().type().toString().equals(eMap.getKey().toString())){ Signature sgn = new Signature(e.signature().type().toString(),e.signature().parameter(param)); //-----> autre solution si c'est possible Integer s = (Integer)table.get(sgn); if (s != null) { nbOcc = s.intValue(); nbOcc++; //compteur d'occurences des evennements table.put(sgn, new Integer(nbOcc)); } if(Math.random() <= k && s== null){ //On rentre sur table.put(sgn, 1); } } } } chrono.stop();
Partager