Hiding the strings of the heart once again in the previous video we talked about the freezer and math
matters.
Now in this video there is talk about 30 kids in case of Cartland.
Now they're pretty good in simple words.
It is just a condition that simply returns a boolean value of true and false.
So what are predicates functions.
So here we have all any gonged and find so that all the better.
Simply ask a question.
Do all elements satisfy the predicate or the condition.
So it was simply return either true or false.
That is a boolean value.
Now here down the side I have any.
So does any method simply ask a simple question.
Do any of the elements present inside the list satisfy that condition or the predicate.
And it is simply again return true or false.
Now downness I have a count mattered there are simply Richter's that are the number of elements that
satisfy the condition or the predicate.
And at last I have a Find method that simply returns the first element that satisfy the predicate.
So from the list it will simply check out the first element from the starting.
There is simply to satisfy their condition and simply return.
So let's check out the code in action inside the intelligence the so here again I have the list of numbers
2 3 4 6 23 and 90 and so on.
Now let us start using the functions of the predicate such as my numbers dog.
All.
Let's start with all Metford.
This all method simply expects a lambda function right.
So here I would simply define the lambda function that will be actually a condition.
So here I would simply use num going into num greater than 10.
So find all the numbers that satisfy this condition.
Right.
It simply means this only.
Now since here we have only one parameter name so it can be replaced by a ate greater than 10.
Now this all Metford simply returns a boolean value.
So I would simply use Val check when equal to my numbers.
Not all.
So this statement simply ask that are all the elements greater than 10.
If it is then simply returns true.
If not then simply returns false.
So in either case it will simply return false because all the numbers are not greater than 10.
Now if you notice here it all is a function that takes the first parameter as a land expression.
So you can also use the function type here as well.
So as a first fearmonger I'm simply passing a lambda.
Now the purpose Vaj I'm using a function here shortly.
Let you know.
Now here let us print the check when.
So as expected we get false in the output console.
Now there us use my numbers.
Got any.
So this any method simply expects a predicate.
So here inside the function I will simply pass the number expression about.
Let's see now I'm going into name greater than 10.
Now here again.
Let's just replace it by it.
So this statement simply asked the question.
Does any of these elements satisfy the condition or the predicate.
So here we have few of the elements such as 23 and 90 that simply satisfy this predicate.
Right so it will simply return true.
So there does use a boolean variable.
Val checked to equal to name.
Now this check is actually of the type of boolean.
So I guess no doubt in this very simple and then simply print out the check to so in the output we get
through here as well.
And now proceeding forward let's just not check out the count.
So my numbers don't count.
So here again I would simply pass the lambda expression Lerche see 80 rather than 10.
So this statement will simply return the number of elements that satisfy the predicate.
So it will simply return the integer value.
Let's say Val total count equal to my numbers.
Now this will be of the type of integer right.
And now let's just print out the value of Godel code.
So here we have two.
So there are only two numbers.
That is 23 and 90 deg to satisfy our condition or the predicate.
Now at the end I have learned see my numbers and dord find.
Now this again expects a lambda as our first var..
So I would simply use.
Id to that and then the condition will be the same.
And here it will simply return the first number that matches the predicate.
So it will simply start counting from 2 and look for the.
And look for the integer variable that simply matches the condition.
That is a predicate.
So as soon as it reaches 23 the condition becomes true.
So 23 actually satisfies this condition.
I do agree to that and then so it will be then stored inside the value of Lerche see name equal to my
numbers right and now they're desperate in doubt.
Alan
and now they're just called
so here in the output we have 23 and we did not get 90 in the output.
And so because Greenberry is a first element starting from the list Darrett satisfy the version of legacy
idea dead and.
Now if you check out the documentation of the find you will find out.
It simply returns the first element matching that given condition or the predicate or null.
If newsis element was found.
So this simply shows that this number is of the type of the label integer right.
So it can also contain the null value.
And now if you notice here that in each of the function we have the repetition of the predicate I degraded
then.
Then Id get rid of that and 10 and so on here as well.
So I said in the previous videos that we can still the lambda function as a variable.
So here what they really do is simply define.
Let's say my lambda Let's see my predicate to be more specific equal to let's say 80 rather than 10.
Now the compiler don't understand Vargus ideas transfer here.
Because here the ID is standing in context of my numbers.
So all the numbers here are being represented as I-T in context of my numbers which is a list of numbers.
But here we don't have any list present here.
So the compiler does not understand vord business.
It is transferred so far that you have to simply use the NUM variable going into no greater than 10.
Now again we have some error.
What is a typo.
This number is variable.
So you need to specify it here as well.
And so this completes our lambda function.
Now now instead of using the grid there and everywhere you can simply replace it by my predicate here.
And again my predicate here and here as well.
Let's just replace it by the function.
My predicate remove it from here.
And on the side here as well.
Lordsburg the brackets inside of which my predicate and null let us read the code.
So here as well we are getting the same output in the output console.
So always remember this about all any gownd and find now there are lots of other metrics as well that
you can find here such as last
last then and so on you can get all these methods down the side.
So as of now I just showed you all the important metrics.
So this video was just to show you.
Valke are pretty scarce in case of Coquelin So they're pretty good.
In short are just a condition that I have declared with the help of a lambda function.
So always remember the predicates are just a condition that returns either true or false.
So this was all about this video.
Thanks for watching.
Start signing off.
Thank you and have a good day.