Java 8
package com.java8.functional; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.function.BinaryOperator; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; public class Test { // Functional interfaces // -Predicate // -BinaryOpeator // -Function public static void main(String[] args) { // -Predicate Predicate<String> strPrd=(s)->s.equals("baya"); Predicate<String> strPrd1=(s)->s.equals("baya1"); System.out.println(strPrd.or(strPrd1).test("baya1")); List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); Predicate<Integer> even=(i)->i%2==0; System.out.println(list.stream().filter(even).collect(Collectors.toList())); System.out.println(list.stream().filter(even.negate()).collect(Collectors.toList())); // -BinaryOpeator B