ERROR - Syntax error on token "(", invalid LambdaBody

Error

Syntax error on token "(", invalid LambdaBody.

Error Type

Compile Time ( Java 8 )

Sample Code

Set<Integer> intSet = new HashSet<Integer>();
intSet.add(1);
intSet.add(2);
intSet.add(3);
intSet.add(4);
System.out.println(intSet.stream().collect(Collectors.groupingBy(p->()));

Cause

The method anyMatch expects the argument as the Predicate and not the String. 

Resolution

Specify the Lambda body appropriately.

Set<Integer> intSet = new HashSet<Integer>();
intSet.add(1);
intSet.add(2);
intSet.add(3);
intSet.add(4);

System.out.println(intSet.stream().collect(Collectors.groupingBy(p->((Integer)p)%2)));