Simplifier fonctions en Java
Bonjour,
Voilà se que je souhaite faire : j'ai un objet en java 'mon_objet' et je souhaite le tester avec des fonctions :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public class mainClass {
public static void main() {
mon_objet A = new mon_objet("X");
test(A);
}
public Boolean test(mon_objet A) {
Boolean res_of_test = false;
if (test_001(A)) {
if (test_002(A)) {
if (test_003(A)) {
[...]
if (test_00n(A)) {
res_of_test = true;
}
}
}
}
return res_of_test;
}
} |
j'aimerais simplifier mon code avec un truc du genre :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| public class mainClass {
public static void main() {
mon_objet A = new mon_objet("X");
test(A);
}
public Boolean test(mon_objet A) {
list_of_test list_of_test = new list_of_test();
while (list_of_test(A))
list_of_test.next();
return list_of_test.isFinished();
}
} |
comment faire svp ?
Merci.