I am new to Java 8 features and this may be a stupid question but I am stuck at this point.
I am trying to run following code in eclipse but it gives compile time error.
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Stream;
import ch.lambdaj.Lambda;
public class LambdajTest {
public static void main(String[] args) {
List list = new ArrayList();
list.add(1);
list.add(3);
list.add(8);
list.add(10);
list.add(16);
int sum = list.stream().filter(p -> p > 10).mapToInt(p -> p).sum();
}
}
Error is :- p cannot be resolved to a variable. I have added lambdaj 2.3.3 jar at classpath.
Kindly provide solution. Thanks in advance.