చూపుట మాత్రమే
0:03
S… Speaker 2 (11- The Function Interface)
Let's talk about the function interface as the name implies this interface
0:07
S… Speaker 2 (11- The Function Interface)
represents a function or an operation that takes an argument and returns
0:12
S… Speaker 2 (11- The Function Interface)
a value So here we have two generic type parameters T
0:16
S… Speaker 2 (11- The Function Interface)
represents the type of the argument and R represents the type of the result.
0:20
S… Speaker 2 (11- The Function Interface)
So over here
0:22
S… Speaker 2 (11- The Function Interface)
You can see that we have four methods in this interface.
0:25
S… Speaker 2 (11- The Function Interface)
Three of them have an implementation.
0:27
S… Speaker 2 (11- The Function Interface)
The only abstract method is the apply method that takes an argument
0:32
S… Speaker 2 (11- The Function Interface)
of type T and returns a value of type R.
0:35
S… Speaker 2 (11- The Function Interface)
Now just like the previous interfaces,
0:37
S… Speaker 2 (11- The Function Interface)
we have a few specializations of this interface.
0:39
S… Speaker 1 (11- The Function Interface)
For example,
0:40
S… Speaker 2 (11- The Function Interface)
we have by function that takes two arguments and returns a
0:44
S… Speaker 1 (11- The Function Interface)
result.
0:45
S… Speaker 2 (11- The Function Interface)
We also have primitive specializations,
0:48
S… Speaker 2 (11- The Function Interface)
and these specializations fall into three categories.
0:51
S… Speaker 2 (11- The Function Interface)
In the first category,
0:52
S… Speaker 2 (11- The Function Interface)
arguments have a specific type,
0:54
S… Speaker 2 (11- The Function Interface)
but the return value is parameterized.
0:56
S… Speaker 1 (11- The Function Interface)
For example,
0:57
S… Speaker 2 (11- The Function Interface)
int function represents a function that takes a primitive integer.
1:01
S… Speaker 1 (11- The Function Interface)
Take a look.
1:02
S… Speaker 1 (11- The Function Interface)
For example,
1:04
S… Speaker 2 (11- The Function Interface)
here we have the apply method that takes a primitive integer and it
1:08
S… Speaker 2 (11- The Function Interface)
returns a value of type r.
1:10
S… Speaker 1 (11- The Function Interface)
So,
1:11
S… Speaker 2 (11- The Function Interface)
this is int function,
1:14
S… Speaker 2 (11- The Function Interface)
you also have long function and double function.
1:17
S… Speaker 2 (11- The Function Interface)
In the second category,
1:18
S… Speaker 2 (11- The Function Interface)
the argument is parameterized.
1:21
S… Speaker 1 (11- The Function Interface)
For example,
1:22
S… Speaker 2 (11- The Function Interface)
to int function represents a function that returns a primitive integer.
1:26
S… Speaker 2 (11- The Function Interface)
So over here you can see we have a method called apply as
1:31
S… Speaker 2 (11- The Function Interface)
int, the argument is parameterized and the return value is a
1:35
S… Speaker 2 (11- The Function Interface)
primitive integer.
1:36
S… Speaker 2 (11- The Function Interface)
Just like this we have to long function and to double function.
1:40
S… Speaker 2 (11- The Function Interface)
Now in the third category both the argument and the return
1:44
S… Speaker 2 (11- The Function Interface)
type are specialized.
1:45
S… Speaker 1 (11- The Function Interface)
For example
1:46
S… Speaker 2 (11- The Function Interface)
into long function represents a function that takes a primitive integer and
1:51
S… Speaker 2 (11- The Function Interface)
returns a primitive long.
1:52
S… Speaker 1 (11- The Function Interface)
Take a look.
1:53
S… Speaker 2 (11- The Function Interface)
So we have apply as long which takes a primitive
1:57
S… Speaker 2 (11- The Function Interface)
integer and returns a primitive long.
1:59
S… Speaker 2 (11- The Function Interface)
Now let me show you how to use the function interface.
2:02
S… Speaker 2 (11- The Function Interface)
So let's declare a function that takes a string and returns an
2:06
S… Speaker 1 (11- The Function Interface)
integer.
2:07
S… Speaker 2 (11- The Function Interface)
So we type function of string and integer,
2:11
S… Speaker 1 (11- The Function Interface)
we call it map
2:16
S… Speaker 2 (11- The Function Interface)
Now we should set this to a lambda expression that takes a string and returns an
2:20
S… Speaker 1 (11- The Function Interface)
integer.
2:20
S… Speaker 2 (11- The Function Interface)
So let's say our parameter is str then we add the lambda operator
2:25
S… Speaker 2 (11- The Function Interface)
and Here we just want to return the length of this string.
2:28
S… Speaker 2 (11- The Function Interface)
So we type str dot length There's no need to add
2:32
S… Speaker 2 (11- The Function Interface)
a code block or use the return keyword,
2:34
S… Speaker 1 (11- The Function Interface)
okay?
2:35
S… Speaker 2 (11- The Function Interface)
So here we have the map function now to call it
2:39
S… Speaker 2 (11- The Function Interface)
We call it map that apply give it a string like
2:43
S… Speaker 2 (11- The Function Interface)
sky and this returns the length of the string
2:48
S… Speaker 2 (11- The Function Interface)
So we can print it and we get three.
2:53
S… Speaker 2 (11- The Function Interface)
So this is how we can use the function interface in Java

ఈ అపోహింగ్‌ను (స్వయంలేని పద గుర్తింపు) సంప్రదాయం (ఆఫ్యుటికల్ ప్రసంగ గుర్తింపు) రూపొందించారు. దోషములు వుండు. ఫార్మేట్‌ను సంక్లిష్టమైన ఆడియోకు వ్యతిరేకంగా నిర్ధారించండి. AI విధానము

❤️ ప్రేమ STT.ai? మీ స్నేహితులకు చెప్పండి!
సారాంశం
ఈ పిక్సెస్ యొక్క యాక్సెస్‌బిలిటి సంగ్రహం ఉద్భవించుటకు కాంక్వెరర్‌ను నొక్కుము.
పరిగణనలోకి...
ఈ రిపోర్టు గురించి AI ను అడుగుము
ఈ అస్థికల పేటిక గురించి ఏమైనా అడగండి —⁠ ఏ.