Java 8 Streams | Optional Usage and Best Practices | JavaTechie

  Рет қаралды 115,981

Java Techie

Java Techie

3 жыл бұрын

This tutorial will guide you java 8 Optional and its usecase with stream API
Content :
What is Optional ?
why Optional ?
When to use Optional ?
#javatechie #java8 #Stream
GitHub:
github.com/Java-Techie-jt/java8
Blogs:
/ javatechie
Facebook:
/ 919464521471923
guys if you like this video please do subscribe now and press the bell icon to not miss any update from Java Techie
Disclaimer/Policy:
--------------------------------
Note : All uploaded content in this channel is mine and its not copied from any community , you are free to use source code from above mentioned GitHub account

Пікірлер: 110
@meevizagabbai
@meevizagabbai 6 ай бұрын
Directly to the point, no lag, crisp & clear. Keep sharing the content like this 😊👍. Now I know about Optional class. Thanks :⁠-⁠)
@abhilashpatel6852
@abhilashpatel6852 Жыл бұрын
showing documentation first is a solid move. solid tutorial. thanks
@kumarsaroj18
@kumarsaroj18 Жыл бұрын
you are a superb teacher.... I wish I could have come across your channel few years ago... I would be at a different level of java developer. I find all your videos quite engaging, crisp and informative. Keep sharing your knowledge with us.
@Javatechie
@Javatechie Жыл бұрын
Thanks Saroj . Keep learning 😊
@jptechnoservice9013
@jptechnoservice9013 3 жыл бұрын
Keep going nice videos
@amolghule4223
@amolghule4223 2 жыл бұрын
Thanks for such easy and wonderful explanation...!
@peterg.1075
@peterg.1075 2 жыл бұрын
Nyc tutorial....detailed explanation
@dmuniraja361
@dmuniraja361 3 жыл бұрын
Your Explanation always superb
@ramvillagetraveller5312
@ramvillagetraveller5312 2 жыл бұрын
Thanks for posting .. needed content...you explains very well..👍
@sowjanyapeddiraju6532
@sowjanyapeddiraju6532 Жыл бұрын
thank you very much for the clear explanation .your videos make the concept clear.
@akshayverma6216
@akshayverma6216 2 жыл бұрын
Thanks Man, after going through your map vs flatmap video ,I wanted check this optional video. you have explained in a very simple way. Everything is covered and crystal clear.
@nirmesh44
@nirmesh44 3 жыл бұрын
As usual awesome explanation. Great work Bro!
@supun_sandaruwan
@supun_sandaruwan 4 ай бұрын
Great content. Tricky examples... Thank you so much sir ❤❤
@manisshkhaparde7619
@manisshkhaparde7619 2 жыл бұрын
Many many thnx for the awesome example and explanation.
@pratishrutipanda6461
@pratishrutipanda6461 3 жыл бұрын
Nice explanation sir ji
@LwP79
@LwP79 Жыл бұрын
There are many good teachers. But you are one of the best among them.👏👏👏
@Javatechie
@Javatechie Жыл бұрын
Thanks buddy 😊
@EdwinRebolledo
@EdwinRebolledo 3 жыл бұрын
great explanation! thanks.
@vaibhavsrivastava4645
@vaibhavsrivastava4645 2 жыл бұрын
Nice explanation
@seyhaseng1077
@seyhaseng1077 Жыл бұрын
Thank you for the java course You are legendary
@kiransomase2493
@kiransomase2493 Жыл бұрын
Really a informative Videos.
@blaugranisto
@blaugranisto 2 жыл бұрын
Great channel! Love your content mate.
@kirane5911
@kirane5911 7 ай бұрын
Very good explanation sir🎉🎉🎉🎉🎉
@user-bs3rz8ne9i
@user-bs3rz8ne9i 3 ай бұрын
You are the best teacher , thanks sir
@Sushil2874
@Sushil2874 2 жыл бұрын
Nice explanation..!!
@ANKITCHOUDHARYankitkrchy
@ANKITCHOUDHARYankitkrchy 2 жыл бұрын
Commendable job
@sheshankgolli2667
@sheshankgolli2667 3 жыл бұрын
awesome
@sandhyamachani8720
@sandhyamachani8720 2 жыл бұрын
Nice explanation broo
@kishordige9721
@kishordige9721 Жыл бұрын
Keep up the good work 😊
@alone_man3198
@alone_man3198 Жыл бұрын
Superb tutorial. All concepts of optional cleared. Thanku brdr
@Javatechie
@Javatechie Жыл бұрын
Thanks Alone keep learning 😃
@revan_hajiyev
@revan_hajiyev 2 ай бұрын
thanks for smooth explanation brother )
@deeptoadhikary689
@deeptoadhikary689 Жыл бұрын
Thank you so much
@gopisambasivarao5282
@gopisambasivarao5282 11 ай бұрын
Complete you tube channels on Java... I will follow only your videos as first reference for specific topic. Which is more clear and understandable.. You are awesome teacher. God bless you Brother. Please add every week one new topic
@Javatechie
@Javatechie 11 ай бұрын
Thank you so much Gopi 🤗. Glad to hear this
@diegoramos27
@diegoramos27 2 жыл бұрын
Thank you, Only thing is I don't see any difference against checking 200 fields with null check, now this would be checking 200 fields with Optionals/ifPresent etc...
@francksgenlecroyant
@francksgenlecroyant 2 жыл бұрын
Huuuum, amazing! I enjoyed this! Thanks!
@Javatechie
@Javatechie 2 жыл бұрын
Thanks buddy 😊
@kishordige4654
@kishordige4654 2 жыл бұрын
Thank you!
@adkk1996
@adkk1996 2 жыл бұрын
thats best video for the optional class nd u r simply the best
@bnitheesh9186
@bnitheesh9186 3 жыл бұрын
Man... U r just awesome yaaar💥
@Javatechie
@Javatechie 3 жыл бұрын
Thanks buddy ☺️
@manisshkhaparde7619
@manisshkhaparde7619 2 жыл бұрын
Thanks!
@vikasbaghel2647
@vikasbaghel2647 2 жыл бұрын
You can use Ctrl + d shortcut to copy paste any line.
@arunbandari8936
@arunbandari8936 3 жыл бұрын
sir which is the best way to protect or secure application.prop file credential in spring boot in Monolithic application .this is new my task how to do please explain sir...
@goku6272
@goku6272 3 жыл бұрын
ArrayList list=new ArrayList(); list.add("Mango"); list.add("Apple"); list.add("Banana"); list.add("Grapes"); Optional list1=Optional.ofNullable(list); list1.filter((item)->{ System.out.println(item); return true;}) or ist1.map((item)->{ System.out.println(item); return item;}) is there any way with filter and map of optional to iterate one by one on array element when i using this it returning me the whole array.
@saravanprathi6956
@saravanprathi6956 3 жыл бұрын
Wow, upcoming videos on reactive programming!! :-)
@Javatechie
@Javatechie 3 жыл бұрын
Yes complete with test coverage and cloud
@saravanprathi6956
@saravanprathi6956 3 жыл бұрын
@@Javatechie awesome!!
@ThePomelo09
@ThePomelo09 3 жыл бұрын
@@Javatechie thanksss!! :D
@sreddy8141
@sreddy8141 2 жыл бұрын
When can we expect this series? 😀
@Javatechie
@Javatechie 2 жыл бұрын
Please checkout my reactive programming series
@overview1662
@overview1662 2 жыл бұрын
@21:00 best practice, watch this video completely
@sharad1957
@sharad1957 3 жыл бұрын
thanks basant for nice content .please upload video for parallel stream,lazy strems in java8.
@Javatechie
@Javatechie 3 жыл бұрын
Okay I will try that
@mdrashidalam5282
@mdrashidalam5282 3 жыл бұрын
Sir please explain java 11 tutorial
@arulrajkumaraselvan3013
@arulrajkumaraselvan3013 3 жыл бұрын
Why can't we use object.getSomething() ! = null instead of using object.isPresent.Then what's the use of optional class??
@Smart-Coder
@Smart-Coder Жыл бұрын
1. Here also need to check whether value is present or not using isPresent() then what is the use of this for that if statement is also required. 2.in case or orelse ,i dont want to set some value if is it null then we need to checked by ispresent() ...so how we can say that its resolved our null check problem?
@sethunest9907
@sethunest9907 28 күн бұрын
Hi @java Techie, Is java is purely object oriented programming?
@prisinha
@prisinha 2 жыл бұрын
Liked 21:00 Best Practice
@monsterhuntergo
@monsterhuntergo Жыл бұрын
Very clear explanation. Thank you very much! Do you also have react js? Thanks.
@Javatechie
@Javatechie Жыл бұрын
No React i started but not much
@praveenreddy9454
@praveenreddy9454 3 жыл бұрын
Hi master,very much clear but still we are checking so many conditions for null checks,where actually it's used better than checking the null check in java7
@vigneshayyandurai7507
@vigneshayyandurai7507 2 жыл бұрын
yes i am also have same question
@RichaBehera129
@RichaBehera129 2 жыл бұрын
In case of returning methods like orelsethrow,orelseGet inside that why u r giving lambda expression . I have doubt on that can u explain. Please reply
@thatoneuser8600
@thatoneuser8600 2 жыл бұрын
Because they take in functional interfaces as arguments. A one-method instance of a class that implements an interface that only has one abstract method can be created in a few different ways. If we don't plan on using it later, we would use an anonymous class or a lambda expression. In this case, an anonymous class is overkill, because it requires a lot of template syntax for a small simple implementation of a one method interface, so Java added lambda expressions to do the same thing but simpler. Lambda expressions create instances of one-method classes, and don't have a name to refer to. They're lexically scoped. They can only be created in places where the compiler can infer a target type from the context.
@siddhilalabobo3597
@siddhilalabobo3597 3 жыл бұрын
Great Video, can you make a video on how to encrypt DB password which is declare in a spring properties file (spring boot) like spring.dbpasswrod ="abc" .
@Javatechie
@Javatechie 3 жыл бұрын
You can use spring jasypt
@orangefield2308
@orangefield2308 6 ай бұрын
Thank you, Only thing is I don't see any difference against checking 200 fields with null check, now this would be checking 200 fields with Optionals/ifPresent etc..@@Javatechie
@Srini8174
@Srini8174 3 жыл бұрын
Good explanation,please start on reactjs for backend developer
@Javatechie
@Javatechie 3 жыл бұрын
Yes man kunernates and React is my next plan
@Vogel42
@Vogel42 3 жыл бұрын
It's worth to point out that any statement inside ".orElse()" is ALWAYS executed. for example: try calling a function with a print inside ".orElse()". The print statement will be executed regardless of the whether the object is null or not. This might be cause a problem if in the ".orElse()" is an expensive function call (like a database query or a network request). So, it's recommended to use ".orElseGet()" in that case.
@Javatechie
@Javatechie 3 жыл бұрын
If value is not null then orElse() won't call
@Vogel42
@Vogel42 3 жыл бұрын
@@Javatechie on the contrary. It will be called. but the value will not be returned. try out a function with a executes a print statement then returns a value.
@Javatechie
@Javatechie 3 жыл бұрын
Let me verify this once thanks
@sreesri8492
@sreesri8492 3 жыл бұрын
orElseGet() is always executed(eager) not orElse()(lazy)
@ahishnar1568
@ahishnar1568 2 жыл бұрын
@@Javatechie verified ?
@ranjanmohanty2788
@ranjanmohanty2788 3 жыл бұрын
Sir app..java ki full series banaiye..jyse..har koi samaj sake..with practical
@ranjanmohanty2788
@ranjanmohanty2788 3 жыл бұрын
Sir.. app java ki. trainning denge kya.. ..we would like to join.
@sreddy8141
@sreddy8141 2 жыл бұрын
Java can also be considered as partial object oriented right sir? As it supports primitives too, its not pure object oriented. Correct me if im wrong
@Javatechie
@Javatechie 2 жыл бұрын
Yes
@sqb8980
@sqb8980 2 жыл бұрын
But you can make it purely object oriented by only making use of wrapper classes Ps: if performance is of no concern
@vaibhavkalgude9316
@vaibhavkalgude9316 11 ай бұрын
If we use Optional.of() when we know the object is not null, then what is the purpose of using it?
@Javatechie
@Javatechie 11 ай бұрын
Buddy we never know where we will get null value so to avoid NPE it's good to have it
@shubhamkumarjha3587
@shubhamkumarjha3587 2 жыл бұрын
Can we create optional of the customer class object ?
@Javatechie
@Javatechie 2 жыл бұрын
Yes we can for list of custom object
@ravikumar-ze6el
@ravikumar-ze6el 2 жыл бұрын
How to filter dates using stream
@sarojsahoo8763
@sarojsahoo8763 3 жыл бұрын
Also in ofNullable method if we get null we return empty but if non null we proceed ..still i could see there is a null check inside by Java people
@Javatechie
@Javatechie 3 жыл бұрын
Additionally we were not doing this job , If object not null it will call of() method and inside of() method null check will not happen because it contains value
@gireeshpoluru3585
@gireeshpoluru3585 3 жыл бұрын
Bro do playlist for java8 streams
@Javatechie
@Javatechie 3 жыл бұрын
Yes it is already there please check in playlist section
@sarojsahoo8763
@sarojsahoo8763 3 жыл бұрын
But it can not handle if empty string is returned
@Javatechie
@Javatechie 3 жыл бұрын
Didn't get you
@sreesri8492
@sreesri8492 3 жыл бұрын
In that case you need write like this . filter(StringUtils::isNotEmpty). orElse("default")
@logeshwarandhanapal6825
@logeshwarandhanapal6825 3 жыл бұрын
Do you have micro services tutorial
@Javatechie
@Javatechie 3 жыл бұрын
Yes you can refer this kzbin.info/www/bejne/qp3NpneDost9sJo If you want you can checkout my microservice playlist
@Mohit-gb9dv
@Mohit-gb9dv 3 жыл бұрын
Kotlin video plzZ
@Javatechie
@Javatechie 3 жыл бұрын
It's already there please checkout kotlin playlist
@rishiraj2548
@rishiraj2548 Жыл бұрын
Please make the ads in the beginning of your videos skippable.
@Javatechie
@Javatechie Жыл бұрын
It's not in my hand buddy
@expertpic
@expertpic 2 жыл бұрын
I think Java is not PURELY OBJECT ORIENTED LANGUAGE , there are primitive in java
@manishmehta3025
@manishmehta3025 2 жыл бұрын
Are you oriya... you sound like one
@softwaretestinginterviewqa5192
@softwaretestinginterviewqa5192 3 жыл бұрын
oriya boy
@NagaSanthosh
@NagaSanthosh 3 жыл бұрын
Content is good but not the accent..
@saurabhsharma7942
@saurabhsharma7942 3 жыл бұрын
Ignore the accent, focus on getting the knowledge. It's not costing you a single penny, grab the information for free.
@NagaSanthosh
@NagaSanthosh 3 жыл бұрын
@@saurabhsharma7942 ya I tried my best but still....
@Robin-hi4vj
@Robin-hi4vj 10 ай бұрын
I know what you mean, but it's understandable. There are other people with worse pronunciation or entonation, but it doesn't mean he can't improve. They have to use Elsa Speak to improve entonation and pronunciation.
Java 8 Streams | map() and reduce()  Example | JavaTechie
18:11
Java Techie
Рет қаралды 93 М.
Java 8 Streams | map () & flatMap() Example | JavaTechie
15:37
Java Techie
Рет қаралды 202 М.
Тяжелые будни жены
00:46
К-Media
Рет қаралды 4,5 МЛН
SOLID Design Principles in java with Example | JavaTechie
34:44
Java Techie
Рет қаралды 171 М.
Method Reference in Java 8
21:06
Telusko
Рет қаралды 175 М.
Optional by Stuart Marks
48:21
Devoxx
Рет қаралды 30 М.
Stream API in Java
26:04
Telusko
Рет қаралды 262 М.
Samsung or iPhone
0:19
rishton vines😇
Рет қаралды 7 МЛН
Он Отказался от БЕСПЛАТНОЙ видеокарты
0:40
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 2 МЛН
#miniphone
0:18
Miniphone
Рет қаралды 3,4 МЛН