6- Completable Futures
Jul 03, 2026 23:03
· 1:38
· English
· Whisper Turbo
· 2 කථානායක
මේ පිටපත අද කල් ඉකුත් වෙනවා.
ස්ථිර ගබඩාව සඳහා උසස් →
පෙන්වමින් පමණක්
0:03
S…
Speaker 1 (6- Completable Futures)
Throughout the rest of this section,
0:05
S…
Speaker 1 (6- Completable Futures)
we're going to talk about a very important type called completable future.
0:08
S…
Speaker 1 (6- Completable Futures)
As you can see this class implements the future interface.
0:12
S…
Speaker 1 (6- Completable Futures)
So every completable future is a future object.
0:15
S…
Speaker 1 (6- Completable Futures)
Now the reason this is called completable future is that with this we can
0:19
S…
Speaker 1 (6- Completable Futures)
explicitly complete a future object.
0:22
S…
Speaker 1 (6- Completable Futures)
This is not something that we can do with the future interface.
0:25
S…
Speaker 1 (6- Completable Futures)
Now, this class also implements another interface called completion stage.
0:29
S…
Speaker 1 (6- Completable Futures)
If you look at the documentation,
0:31
S…
Speaker 1 (6- Completable Futures)
it says that this interface represents a stage of a
0:35
S…
Speaker 1 (6- Completable Futures)
possibly asynchronous operation.
0:37
S…
Speaker 2 (6- Completable Futures)
What does this mean?
0:38
S…
Speaker 2 (6- Completable Futures)
Well,
0:39
S…
Speaker 1 (6- Completable Futures)
in the real world,
0:40
S…
Speaker 1 (6- Completable Futures)
quite often an asynchronous operation involves many steps.
0:43
S…
Speaker 1 (6- Completable Futures)
For example,
0:44
S…
Speaker 1 (6- Completable Futures)
we may call a remote API to get some data.
0:46
S…
Speaker 1 (6- Completable Futures)
That is one step.
0:47
S…
Speaker 1 (6- Completable Futures)
Then perhaps we want to transform that data into a different structure.
0:50
S…
Speaker 1 (6- Completable Futures)
That's another step.
0:52
S…
Speaker 1 (6- Completable Futures)
And finally,
0:53
S…
Speaker 1 (6- Completable Futures)
we want to write that data into a database.
0:54
S…
Speaker 1 (6- Completable Futures)
That's another step.
0:55
S…
Speaker 1 (6- Completable Futures)
This interface represents a step or a stage of an asynchronous operation.
1:00
S…
Speaker 1 (6- Completable Futures)
And it gives us a bunch of methods for combining and composing
1:04
S…
Speaker 1 (6- Completable Futures)
these steps in a declarative way,
1:06
S…
Speaker 1 (6- Completable Futures)
kind of like how we use the streams API to build a complex query in
1:10
S…
Speaker 2 (6- Completable Futures)
a declarative way.
1:11
S…
Speaker 2 (6- Completable Futures)
Earlier,
1:12
S…
Speaker 1 (6- Completable Futures)
we use the map filter and reduce methods to build a complex query.
1:16
S…
Speaker 1 (6- Completable Futures)
Now we can do the same thing with this completion stage interface.
1:20
S…
Speaker 1 (6- Completable Futures)
I'm going to show you how to do that later in this section.
1:22
S…
Speaker 1 (6- Completable Futures)
So over the next few videos,
1:24
S…
Speaker 1 (6- Completable Futures)
we're going to talk about the completable feature class.
1:27
S…
Speaker 1 (6- Completable Futures)
I'm going to show you how to use this class to build complex asynchronous
1:31
S…
Speaker 1 (6- Completable Futures)
operations.
1:32
S…
Speaker 1 (6- Completable Futures)
But first,
1:32
S…
Speaker 1 (6- Completable Futures)
let me show you how to create a completable feature object.
මෙම පරිවර්තනය AI විසින් ජනනය කරන ලදී (ස්වයංක්රීය කථාව හඳුනා). දෝෂ අඩංගු විය හැක - විවේචනාත්මක භාවිතය සඳහා මුල් ශ්රව්ය එරෙහිව තහවුරු. AI ප්රතිපත්තිය
සාරාංශය
මෙම පරිවර්තනය AI සාරාංශයක් ජනනය කිරීමට සාරාංශ ක්ලික් කරන්න.
සාරාංශගත කිරීම...
මෙම පරිවර්තනය ගැන AI අහන්න
මෙම පරිවර්තනය ගැන යමක් අහන්න - AI අදාළ කොටස් සොයා සහ පිළිතුරු දෙනු ඇත.