79635664

Date: 2025-05-23 14:05:11
Score: 1
Natty:
Report link

Just let Integer.intValue() fail with NullPointerException and catch it.

Integer result;
try {
    result = intList.stream().mapToInt(Integer::intValue).sum();
} catch (NullPointerException e) {
    result = null;
}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: ds1