Это кажется некрасивым:
Код: Выделить всё
if (someList != null) {
for (Object object : someList) {
// do whatever
}
}
Код: Выделить всё
if (someList == null) {
return; // Or throw ex
}
for (Object object : someList) {
// do whatever
}
Подробнее здесь: https://stackoverflow.com/questions/225 ... d-for-loop
Мобильная версия