Heider knowledge just continue on. 2
Arrest them all in the last name or look that sequence of operations which are the code operations on 3
which would be used which would be using most frequently. 4
Now let's look at the pattern operations. 5
We said that there are some parlays operations which have been introduced in July 8. 6
So let's go ahead and look at them and we're just going to look at three of them attached. 7
So these are Barlows operations which means that if there is a multi If your system has multiple cost 8
then these methods can use make use of those multiple course in order to you parallelism. 9
And also a Jew efficiency would be more much more efficient because things are done and batla OK. 10
So there are three matters that we're are going to look at what is palace saw on his panel prefix. 11
Another one is Bartlet's set. 12
So popular sought is just like the song. 13
The output would be just a song sort operation we have seen in the last lesson Sirtis and and put out 14
a undercharge elements. 15
OK so the input arrays. 16
Once again the same elements going to be three for them. 17
Right now the specification says that this would be beneficial only if for large art is OK for large 18
arrays we're missing large areas. 19
It has to have at least eight thousand one hundred or nine elements. 20
That is one love shift. 21
So if that's the minimum size only then it will use closed operations otherwise internally if it is 22
less than this size it would only use the same old sequential sock method. 23
OK so let me just go ahead and run this. 24
Let me just comment this sequential part. 25
So in this case it would still use the oil soaked method. 26
OK. 27
So if it has more than this then you can make use of a bottle of soft and liquid be faster. 28
I think roughly it is around four times faster just based on some article that I read. 29
So I did not do any performance tests on this bench months. 30
So that's about the I. 31
The parallel sorting. 32
OK. 33
Next Next look at parler prefix on batla prefix. 34
Basically it would communards that each element of w an array. 35
So which means that if you have elements like this to 1 0 3 then the returned array. 36
Well how elements like you. 37
And the second would be accumulation of first and the second element. 38
So it would be three. 39
And the third element would be the sum of the sum three. 40
And the third element which is zero. 41
So it would be accumulator of the element values. 42
So to me just run this as you can see it is foretold 706 initially is four than four and 23 are harder 43
to get 27 and so on and 59. 44
And in order to get the final value which is 86 yes that's Parnell it's OK. 45
Now this mattered. 46
It takes two parameters. 47
One is an injury and the other one the corner does and the binary operator and binary operator is an 48
interface and they call that as a function interface function interfaces. 49
How just one method. 50
And so we can pass an implementation on that implementation could be lambda function or it can be matter 51
or France or it can be an anonymous function or it can be an implementation such as this which we are 52
going to show you her. 53
So later about the same thing also applies here for Barlas cycle. 54
We can use all of those new features like lambda. 55
So we merely revisit these methods when we discuss some of those features like clampdowns Armato references 56
on anonymous functions. 57
But for now we are going to implement this interface that we have seen here call it binary operator 58
and it's already done here. 59
It's here in binary operator implementation or implements that method function interface under interface 60
as meticulous. 61
Apply as an extra parameters and we are simply arding dup the values that are passed to this method 62
. 63
OK so we are passing an instance of this implementation and Parlow prefix in Donelly it in walk that 64
particular method in this implementation. 65
So that's the panel prefix. 66
Now let's look at the third one which is Barlows set all parlance at all basically sets each element 67
in the eye array in the array to some value OK some value and Barlas at all is also like like the previous 68
Metoprolol prefix. 69
It also takes a functional interferes as in book. 70
So you need to pass an instance of this an instance of this particular interface function interface 71
. 72
Once again we are passing an implementation and we call it us into unity operator Grampian it is here 73
it is here. 74
I implemented it and this is the method which I'm introducing in this class. 75
Ok it doesn't belong to any unity operator. 76
And you protect them how does matter apply as. 77
And so we are writing that. 78
OK. 79
And basically for each invocation this matter 80
despotically particular palace that all matter well invoke that mattered in the function interface. 81
For each of the elements and it passes the index on B it doesn't pass the element value but it passes 82
on the index. 83
Once again here we go. 84
If you look at that. 85
So this is a parlor set all matter. 86
So as you can see it in walks that Blye as in k now under underpasses only eyeball you eye is basically 87
the index. 88
So if you go back here. 89
So that's what it is happening in the this or mogas 90
comin out. 91
So let me do this. 92
So as you can see it is simply passing 0 1 and 2. 93
Here it is it's passing. 94
Initially it passes zero. 95
And this not ever be 0 ever been null because I'm not invoking the perimeter. 96
So in that case I thought it would be none. 97
So every time it goes into this block on your computer turns the index that is passed. 98
OK so finally the order the input articles passed then have these three values initially in the first 99
iteration it were a zero would be past which is a next number then one and then two. 100
OK. 101
So that. 102
So the update will be updated with those values. 103
But if you want to update the army because something has to do each element of the or if you want to 104
update because some other value rather than an index then you can do something like this. 105
You can pass the ID OK. 106
And which means that it will be none here there is this and this is the second method and it would not 107
be null. 108
And here we are saying when it passes the zeroth index we are seeing modify that element out of 5 in 109
this case. 110
But it can be anything it can be plus operation or multiplication. 111
It just depends on your on your project. 112
OK. 113
So but in this case I'm just simply adding 5 to every other element. 114
OK. 115
So instead of doing it in a for loop or something like that using a single statement you can have fit 116
the values of in the ID. 117
OK. 118
Say for example if it's a banking application and if there are lot of balances and if you want to just 119
multiply them with some interest rate then you can do it in one go. 120
So if I do this as you can see we're writing five survivors being added too far and then going to seven 121
. 122
So it's good study too. 123
I was ordered to 86 and that's 91. 124
So these are paralyzed operations and they will be used only if there is a multi-course system. 125
In English what Barlow saw this is the number of elements that are needed. 126
I'm not sure about other other two methods. 127
So so Palethorpe is mainly for achieving vandalism. 128
OK. 129
So those are ordered in Java 8. 130
So that's about it. 131
So this also this new method is also added to the class on what is available in the resource section 132
. 133
Thank you. 134
And happy coding.