JavaCompilerCore/resources/bytecode/javFiles/ForEach.jav
Daniel Holle e354838491
Some checks failed
Build and Test with Maven / Build-and-test-with-Maven (push) Failing after 2m45s
Use wildcard constraint in foreach, fixes #291 and hopefully doesn't break anything
2024-03-14 10:23:19 +01:00

23 lines
442 B
Java

import java.util.ArrayList;
import java.lang.Integer;
import java.lang.Number;
public class ForEach {
public m() {
var list = new ArrayList<>();
list.add(1); list.add(2); list.add(3);
var sum = 0;
for (var i : list) {
sum = sum + i;
}
return sum;
}
public m2() {
var list = new ArrayList<? extends Number>();
for (Number n : list) {
}
}
}