Java 8 Streams | Optional Usage and Best Practices | JavaTechie

  Рет қаралды 120,350

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

Пікірлер: 111
@kumarsaroj18
@kumarsaroj18 2 жыл бұрын
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 2 жыл бұрын
Thanks Saroj . Keep learning 😊
@meevizagabbai
@meevizagabbai 8 ай бұрын
Directly to the point, no lag, crisp & clear. Keep sharing the content like this 😊👍. Now I know about Optional class. Thanks :⁠-⁠)
@LwP79
@LwP79 2 жыл бұрын
There are many good teachers. But you are one of the best among them.👏👏👏
@Javatechie
@Javatechie 2 жыл бұрын
Thanks buddy 😊
@abhilashpatel6852
@abhilashpatel6852 Жыл бұрын
showing documentation first is a solid move. solid tutorial. thanks
@nirmesh44
@nirmesh44 3 жыл бұрын
As usual awesome explanation. Great work Bro!
@amolghule4223
@amolghule4223 3 жыл бұрын
Thanks for such easy and wonderful explanation...!
@sowjanyapeddiraju6532
@sowjanyapeddiraju6532 Жыл бұрын
thank you very much for the clear explanation .your videos make the concept clear.
@blaugranisto
@blaugranisto 3 жыл бұрын
Great channel! Love your content mate.
@ramvillagetraveller5312
@ramvillagetraveller5312 2 жыл бұрын
Thanks for posting .. needed content...you explains very well..👍
@dmuniraja361
@dmuniraja361 3 жыл бұрын
Your Explanation always superb
@peterg.1075
@peterg.1075 3 жыл бұрын
Nyc tutorial....detailed explanation
@supun_sandaruwan
@supun_sandaruwan 6 ай бұрын
Great content. Tricky examples... Thank you so much sir ❤❤
@jptechnoservice9013
@jptechnoservice9013 3 жыл бұрын
Keep going nice videos
@manisshkhaparde7619
@manisshkhaparde7619 2 жыл бұрын
Many many thnx for the awesome example and explanation.
@seyhaseng1077
@seyhaseng1077 Жыл бұрын
Thank you for the java course You are legendary
@akshayverma6216
@akshayverma6216 3 жыл бұрын
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.
@gopisambasivarao5282
@gopisambasivarao5282 Жыл бұрын
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 Жыл бұрын
Thank you so much Gopi 🤗. Glad to hear this
@EdwinRebolledo
@EdwinRebolledo 3 жыл бұрын
great explanation! thanks.
@pratishrutipanda6461
@pratishrutipanda6461 3 жыл бұрын
Nice explanation sir ji
@user-bs3rz8ne9i
@user-bs3rz8ne9i 5 ай бұрын
You are the best teacher , thanks sir
@kiransomase2493
@kiransomase2493 Жыл бұрын
Really a informative Videos.
@francksgenlecroyant
@francksgenlecroyant 2 жыл бұрын
Huuuum, amazing! I enjoyed this! Thanks!
@Javatechie
@Javatechie 2 жыл бұрын
Thanks buddy 😊
@Sushil2874
@Sushil2874 3 жыл бұрын
Nice explanation..!!
@vaibhavsrivastava4645
@vaibhavsrivastava4645 2 жыл бұрын
Nice explanation
@alone_man3198
@alone_man3198 Жыл бұрын
Superb tutorial. All concepts of optional cleared. Thanku brdr
@Javatechie
@Javatechie Жыл бұрын
Thanks Alone keep learning 😃
@kishordige9721
@kishordige9721 Жыл бұрын
Keep up the good work 😊
@deeptoadhikary689
@deeptoadhikary689 Жыл бұрын
Thank you so much
@ANKITCHOUDHARYankitkrchy
@ANKITCHOUDHARYankitkrchy 2 жыл бұрын
Commendable job
@kirane5911
@kirane5911 9 ай бұрын
Very good explanation sir🎉🎉🎉🎉🎉
@sandhyamachani8720
@sandhyamachani8720 3 жыл бұрын
Nice explanation broo
@revan_hajiyev
@revan_hajiyev 5 ай бұрын
thanks for smooth explanation brother )
@kishordige4654
@kishordige4654 2 жыл бұрын
Thank you!
@bnitheesh9186
@bnitheesh9186 3 жыл бұрын
Man... U r just awesome yaaar💥
@Javatechie
@Javatechie 3 жыл бұрын
Thanks buddy ☺️
@sheshankgolli2667
@sheshankgolli2667 3 жыл бұрын
awesome
@manisshkhaparde7619
@manisshkhaparde7619 2 жыл бұрын
Thanks!
@adkk1996
@adkk1996 3 жыл бұрын
thats best video for the optional class nd u r simply the best
@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
@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...
@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.
@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...
@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 3 жыл бұрын
When can we expect this series? 😀
@Javatechie
@Javatechie 3 жыл бұрын
Please checkout my reactive programming series
@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
@overview1662
@overview1662 2 жыл бұрын
@21:00 best practice, watch this video completely
@Srini8174
@Srini8174 3 жыл бұрын
Good explanation,please start on reactjs for backend developer
@Javatechie
@Javatechie 3 жыл бұрын
Yes man kunernates and React is my next plan
@mdrashidalam5282
@mdrashidalam5282 3 жыл бұрын
Sir please explain java 11 tutorial
@prisinha
@prisinha 2 жыл бұрын
Liked 21:00 Best Practice
@arulrajkumaraselvan3013
@arulrajkumaraselvan3013 3 жыл бұрын
Why can't we use object.getSomething() ! = null instead of using object.isPresent.Then what's the use of optional class??
@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.
@sethunest9907
@sethunest9907 3 ай бұрын
Hi @java Techie, Is java is purely object oriented programming?
@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 ?
@AvinashKumarInsights
@AvinashKumarInsights Жыл бұрын
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?
@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 9 ай бұрын
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
@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.
@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
@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
@sreddy8141
@sreddy8141 3 жыл бұрын
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 3 жыл бұрын
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
@rk123692008
@rk123692008 Ай бұрын
Ways to create Optional class empty of ofNullable
@vaibhavkalgude9316
@vaibhavkalgude9316 Жыл бұрын
If we use Optional.of() when we know the object is not null, then what is the purpose of using it?
@Javatechie
@Javatechie Жыл бұрын
Buddy we never know where we will get null value so to avoid NPE it's good to have it
@shubhamkumarjha3587
@shubhamkumarjha3587 3 жыл бұрын
Can we create optional of the customer class object ?
@Javatechie
@Javatechie 3 жыл бұрын
Yes we can for list of custom object
@gireeshpoluru3585
@gireeshpoluru3585 3 жыл бұрын
Bro do playlist for java8 streams
@Javatechie
@Javatechie 3 жыл бұрын
Yes it is already there please check in playlist section
@ravikumar-ze6el
@ravikumar-ze6el 2 жыл бұрын
How to filter dates using stream
@rishiraj2548
@rishiraj2548 Жыл бұрын
Please make the ads in the beginning of your videos skippable.
@Javatechie
@Javatechie Жыл бұрын
It's not in my hand buddy
@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")
@Mohit-gb9dv
@Mohit-gb9dv 3 жыл бұрын
Kotlin video plzZ
@Javatechie
@Javatechie 3 жыл бұрын
It's already there please checkout kotlin playlist
@logeshwarandhanapal6825
@logeshwarandhanapal6825 3 жыл бұрын
Do you have micro services tutorial
@Javatechie
@Javatechie 3 жыл бұрын
Yes you can refer this kzfaq.info/get/bejne/qtKaqKd-0syuqmw.html If you want you can checkout my microservice playlist
@expertpic
@expertpic 2 жыл бұрын
I think Java is not PURELY OBJECT ORIENTED LANGUAGE , there are primitive in java
@manishmehta3025
@manishmehta3025 3 жыл бұрын
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 Жыл бұрын
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
Рет қаралды 97 М.
GitHub Copilot: Basics for IntelliJ
11:06
TechRill
Рет қаралды 28 М.
Задержи дыхание дольше всех!
00:42
Аришнев
Рет қаралды 3,8 МЛН
Опасность фирменной зарядки Apple
00:57
SuperCrastan
Рет қаралды 12 МЛН
小蚂蚁被感动了!火影忍者 #佐助 #家庭
00:54
火影忍者一家
Рет қаралды 32 МЛН
Alex hid in the closet #shorts
00:14
Mihdens
Рет қаралды 18 МЛН
Spring | @Component Annotation Example In Spring #14
14:35
Java Academy
Рет қаралды 85
Spring ultimate basics: What are Spring Beans and what is the Spring Container?
16:30
SOLID Design Principles in java with Example | JavaTechie
34:44
Java Techie
Рет қаралды 182 М.
Java 8 Streams | map () & flatMap() Example | JavaTechie
15:37
Java Techie
Рет қаралды 211 М.
Optionals In Java - Simple Tutorial
15:53
Coding with John
Рет қаралды 204 М.
Better Than Smart Phones☠️🤯 | #trollface
0:11
Not Sanu Moments
Рет қаралды 18 МЛН
Сколько реально стоит ПК Величайшего?
0:37
Хакер взломал компьютер с USB кабеля. Кевин Митник.
0:58
Последний Оплот Безопасности
Рет қаралды 2,3 МЛН