ERROR - The operator [>] is undefined for the argument type(s) Predicate<[Integer]>, int

Error

The operator [>] is undefined for the argument type(s) Predicate<[Integer]>, int 

while using Lambda Expressions in Java 8.

Error Type

Compile Time ( Java 8 )

Sample Code

Predicate<Integer> p = p>3;

Cause

Lambda Expression has not been specified correctly. As p has been declared as the predicate reference, the right p is being thought so and hence complaining about the > operator.

Resolution

Specify the Predicate reference and Lambda Expression correctly

Predicate<Integer> predicate = p->p>3;