I got this. But my list is not empty and they have element with code "ADPL". Why this return me NoSuchElement ?
String retour = CodeExecutionChaine.A.getCode();
if (!lstChaines.isEmpty()) {
retour = lstChaines.stream()
.filter(t -> t.getNomChaine() == Chaines.ADPL.getCode())
.map(Chaine::getStatutChaine)
.findFirst()
.orElse(CodeExecutionChaine.A.getCode());
The enum Chaines
public enum Chaines {
ADPL("ADPL"),
ADIL("ADIL"),
ADSL("ADSL");
private String code = "";
Chaines(String code) {
this.code = code;
}
public String getCode() {
return this.code;
}
}
This is the same for CodeExecutionChaine