3 ms·
public List<Integer> add2(File file) { List<Integer> resultList = new ArrayList<>(); for (int i : ListUtils.emptyIfNull(file.getNumbers())) {
by logn 10y ago
public List<Integer> add2(File file) {
List<Integer> resultList = new ArrayList<>();
for (int i : ListUtils.emptyIfNull(file.getNumbers())) {
resultList.append(i + 2);
}
return resultList;
}
- coldtea 10y agoAnd now you need to use a non-language builtin util everywhere. And this one only works when working with arrays or array like objects... It's amazing how far people will go to defend a bad practice, than even its inventor called a 'billion dollar mistake'.
- ebola1717 10y agoThis returns an empty list when file fails to read, which is not the expected behavior. That's a case that comes up a lot! DB read failed vs DB read 0 items for example.