16- The UnaryOperator Interface

Jul 01, 2026 04:06 · 1:13 · English · Whisper Turbo · 2 স্পিকার
এই ট্ৰান্সক্ৰিপ্টৰ মেয়াদ আজি শেষ হয়। স্থায়ী সংৰক্ষণৰ বাবে উন্নীত কৰক →
অকল প্ৰদৰ্শন কৰা হৈছে
0:03
S… Speaker 1 (16- The UnaryOperator Interface)
The last functional interface we're going to talk about is the unary operator.
0:07
S… Speaker 1 (16- The UnaryOperator Interface)
As you can see,
0:08
S… Speaker 1 (16- The UnaryOperator Interface)
this interface extends the function interface.
0:11
S… Speaker 1 (16- The UnaryOperator Interface)
So a unary operator is a function that takes an argument
0:15
S… Speaker 1 (16- The UnaryOperator Interface)
of type t and returns a value of type t.
0:17
S… Speaker 1 (16- The UnaryOperator Interface)
So let's see how we can use this interface.
0:20
S… Speaker 1 (16- The UnaryOperator Interface)
I'm going to declare a unary operator of
0:24
S… Speaker 1 (16- The UnaryOperator Interface)
integer called square and set it to a lambda expression
0:28
S… Speaker 1 (16- The UnaryOperator Interface)
like this.
0:28
S… Speaker 1 (16- The UnaryOperator Interface)
n goes to n times n.
0:31
S… Speaker 1 (16- The UnaryOperator Interface)
We can declare another unary operator
0:34
S… Speaker 1 (16- The UnaryOperator Interface)
of type integer and call it increment and
0:39
S… Speaker 1 (16- The UnaryOperator Interface)
set it to a lambda like this,
0:40
S… Speaker 1 (16- The UnaryOperator Interface)
n goes to n plus 1.
0:42
S… Speaker 2 (16- The UnaryOperator Interface)
So,
0:43
S… Speaker 1 (16- The UnaryOperator Interface)
first we can increment a value and then we can
0:48
S… Speaker 1 (16- The UnaryOperator Interface)
get the square of the result.
0:49
S… Speaker 1 (16- The UnaryOperator Interface)
Now,
0:50
S… Speaker 1 (16- The UnaryOperator Interface)
let's apply the sequence on 1.
0:53
S… Speaker 1 (16- The UnaryOperator Interface)
So we're going to increment 1,
0:55
S… Speaker 1 (16- The UnaryOperator Interface)
we get 2,
0:55
S… Speaker 1 (16- The UnaryOperator Interface)
the square of 2 is 4.
0:57
S… Speaker 1 (16- The UnaryOperator Interface)
Let's get the result and print it to
1:01
S… Speaker 1 (16- The UnaryOperator Interface)
verify that our sequence of operations are working.
1:05
S… Speaker 1 (16- The UnaryOperator Interface)
There you go.
1:06
S… Speaker 1 (16- The UnaryOperator Interface)
So this is how we can use the unary operator in
1:10
S… Speaker 1 (16- The UnaryOperator Interface)
Java

এই অনুলিপি AI (স্বয়ংক্ৰিয় কথোপকথন স্বীকৃতি) দ্বাৰা সৃষ্টি কৰা হৈছে। ইয়াৰ অন্তৰ্গত ত্ৰুটি থাকিব পাৰে - গুৰুত্বপূৰ্ণ ব্যৱহাৰৰ বাবে মূল অডিঅ'ৰ সৈতে পৰীক্ষা কৰক। AI নীতি

❤️ STT.ai ভাল পায়? আপোনাৰ বন্ধুসকলক কওক!
সাৰাংশ
এই ট্ৰান্সক্ৰিপ্টৰ AI সাৰাংশ সৃষ্টি কৰিবলৈ সাৰাংশ ক্লিক কৰক।
সাৰাংশ...
এই অনুলিপিৰ বিষয়ে AI ক প্ৰশ্ন কৰক
এই অনুবাদৰ বিষয়ে যিকোনো প্ৰশ্ন কৰক — AI-এ প্ৰযোজ্য অংশসমূহ বিচাৰি পাব আৰু উত্তৰ দিব।