private static int somaIterator(List list) { Iterator it = list.iterator(); int soma = 0; while (it.hasNext()) { int num = it.next(); if (num % 2 == 0) { soma += num; } } return soma; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter