I have this expresion and I want to have it in a sigle line using the ?
operator.
for (Area a : listaArea) {
if (a.getIdArea() == user.getIdArea()) {
user.setNomArea(a.getNomArea());
}
}
This is what I tried:
for (Area a : listaArea) {a.getIdArea() == user.getIdArea() ? user.setNomArea(a.getNomArea())}
How to convert that if
into a ?
expresion?