The below code is intuitive in imperative style. Does trying to do the same in declarative style makes it more complex?
for (var entry : map.entrySet()) {
if (entry.getKey().length() > 10) {
return "invalid_key";
} else if (entry.getValue().length() > 10) {
return "invalid_value";
} else if (entry.getKey().isEmpty()) {
return "empty_key";
} else if (entry.getValue().isEmpty()) {
return "empty_value";
}
}
return "all_valid";