Difference between Predicate, Supplier and Consumer ?
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Interview Questions and Answers

 Q1. Difference between Predicate, Supplier and Consumer ? Core Java
Ans. Predicate represents an anonymous function that accepts one argument and produces a result.

Supplier represents an anonymous function that accepts no argument and produces a result.

Consumer represents an anonymous function that accepts an argument and produces no result.

  Sample Code for Predicate

  Sample Code for Supplier

  Sample Code for Consumer

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java8   predicate   consumer   supplier   lambda expression   predicate vs consumer vs supplier      expert


Related Questions

  What is a Lambda Expression ? What's its use ?
  Difference between final and effectively final ? Why is effectively final even required ?
  What does the following lambda expression means ?
  Difference between DoubleSummaryStatistics , IntSummaryStatistics and LongSummaryStatistics ?
 What is the use of :: operator wef from Java 8 ?
 What is a method reference in Java ?
 Lets say we have a set "set1" with objects of Class A, Class has a non static string called element1, Write a code ( using lambda expression ) to see if there is any object in the set with element1 = "Hello".
 Given a collection of Employee objects, how can we get the customers with name starting with 'A' using lambda expression.
 Why do you think lambda expressions are considered such a big thing for Java 8?



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: