{"id":6416,"date":"2015-05-08T23:23:47","date_gmt":"2015-05-08T15:23:47","guid":{"rendered":"http:\/\/onthe8spot.com\/?p=6416"},"modified":"2015-05-08T23:23:47","modified_gmt":"2015-05-08T15:23:47","slug":"how-to-use-predicate-in-java-8-howtodoinjava","status":"publish","type":"post","link":"http:\/\/onthe8spot.com\/index.php\/2015\/05\/08\/how-to-use-predicate-in-java-8-howtodoinjava\/","title":{"rendered":"How to use Predicate in java 8 &#8211; HowToDoInJava"},"content":{"rendered":"<blockquote><p>In mathematics, a predicate is commonly understood to be a Boolean-valued function P: X? {true, false}, called the predicate on X. Informally, a predicate is a statement that may be true or false depending on the values of its variables. It can be thought of as an operator or function that returns a value that is either true or false. In java 8, Predicate a functional interface and can therefore be used as the assignment target for a lambda expression or method reference. So, where you think, you can use these true\/false returning functions in day to day programming? I will say you can use them anywhere where you need to evaluate a condition on group\/collection of similar objects such that evaluation can result either in true or false e.g. 1) Find all children borned after a particular date 2) Pizzas ordered a specific time 3) Employees greater than certain age and so on.. So Predicate seems to be interesting thing. Let\u2019s go deeper. As I said, Predicate is functional interface. It mean we can pass lambda expressions wherever predicate is expected. For example one such method is filter() method from Stream interface.<\/p><\/blockquote>\n<p>Source: <em><a href=\"http:\/\/howtodoinjava.com\/2014\/04\/04\/how-to-use-predicate-in-java-8\/\">How to use Predicate in java 8 &#8211; HowToDoInJava<\/a><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In mathematics, a predicate is commonly understood to be a Boolean-valued function P: X? {true, false}, called the predicate on X. Informally, a predicate is a statement that may be true or false depending on the values of its variables. It can be thought of as an operator or function that returns a value that &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/onthe8spot.com\/index.php\/2015\/05\/08\/how-to-use-predicate-in-java-8-howtodoinjava\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to use Predicate in java 8 &#8211; HowToDoInJava&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[79],"tags":[],"class_list":["post-6416","post","type-post","status-publish","format-standard","hentry","category-reposts"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/posts\/6416","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/comments?post=6416"}],"version-history":[{"count":0,"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/posts\/6416\/revisions"}],"wp:attachment":[{"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/media?parent=6416"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/categories?post=6416"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/onthe8spot.com\/index.php\/wp-json\/wp\/v2\/tags?post=6416"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}