What is Consumer and predicate in Java?

Both the test method and the accept method in the Predicate and Consumer respectively accept a parameter of the generic type declared. The difference between these is that the predicate uses the parameter to make some decision and return a boolean whereas Consumer uses the parameter to change some of its value .

Sizin İçin Seçtik  What are the basic method in Java?

Leave a Reply

Your email address will not be published. Required fields are marked *

What is Consumer and predicate in Java?

Both the test method and the accept method in the Predicate and Consumer respectively accept a parameter of the generic type declared. The difference between these is that the predicate uses the parameter to make some decision and return a boolean whereas Consumer uses the parameter to change some of its value .

Sizin İçin Seçtik  Is Java OOP or functional?

Leave a Reply

Your email address will not be published. Required fields are marked *