Java Optionals | Crash Course

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ต.ค. 2024

ความคิดเห็น • 135

  • @rolmertelis
    @rolmertelis 3 ปีที่แล้ว +7

    Even for not native english speackers, your classes are very useful. You are a fantastic teacher. Health, love, peace and success!

  • @deepakjava3506
    @deepakjava3506 4 ปีที่แล้ว +3

    I have never seen anyone so clear in teaching. You are born talented.

  • @nazariitkachuk9274
    @nazariitkachuk9274 5 ปีที่แล้ว +54

    Great tutorial!!!
    I'm not an English native speaker, still I got all information i needed))
    Thank you!

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว +5

      Thank you Nazarri

  • @gulrahim321
    @gulrahim321 4 ปีที่แล้ว +6

    Dude i learned more from u in 15 min than a whole semester for my professor. Thx man keep up with the good work.

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว

      You are welcome 🙏

  • @diptidesai7399
    @diptidesai7399 4 ปีที่แล้ว +18

    Brother , you are a good teacher.

  • @dangtrithuctran2341
    @dangtrithuctran2341 4 ปีที่แล้ว +3

    Hi Amigoscode,
    I've just got to know your channel these days and this is a really great channel for me to follow, to be honest. Thank you so much for your time and effort to make your videos.
    By the way, during the time watching your videos, I found you used some amazing shortcuts frequently which help to save a lot of coding time. Could your please let me know those shortcuts for:
    1. Changing a specific code to method reference, as at 10:07
    2. Extracting a variable to hold the value of specific code. For example: List vehicles = abc.getVehicles();
    3. Replacing all of a specific text by another at once, as at 3:32
    Many thanks

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว +1

      Hi 👋 . Thanks for your comment. Means a lot. So in this course I cover all shortcuts. th-cam.com/video/yefmcX57Eyg/w-d-xo.html&t

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว +1

      Also you can see the keyboard shortcuts in the video.

    • @dangtrithuctran2341
      @dangtrithuctran2341 4 ปีที่แล้ว

      @@amigoscode thank you so much for your response. By the way, I just want to let you know that I am going to take your Spring+React course and I hope it would be going well. :D

  • @gillianbc
    @gillianbc 5 ปีที่แล้ว +6

    Very clearly explained, good examples, thank you. Worth noting that the tutorial is for Java 11. Optionals were introduced in Java 8 but with fewer features e.g. no isEmpty()

    • @amigoscode
      @amigoscode  5 ปีที่แล้ว +1

      Yup absolutely right

    • @uzairtext4610
      @uzairtext4610 4 ปีที่แล้ว

      Also ifPresentOrElse(); is not is java 8, The LTS version of java widely used ...!!!

  • @andrenevesjunior5714
    @andrenevesjunior5714 4 ปีที่แล้ว +10

    amazing explanation, you should create some playlist related to Collections, data structures and best practices. Thanks bro

  • @Easy_3dot14
    @Easy_3dot14 2 ปีที่แล้ว +1

    Best Java tutorials I’ve seen are on your channel 🙌🏽

  • @emm_arr
    @emm_arr 2 ปีที่แล้ว

    I think this is clear ... and thank you. But I have to observe that as I write a lot of methods that return null as a fallback, explicit null checks are easy and often absolutely necessary depending upon what you need a program to do.

  • @victoryb.5437
    @victoryb.5437 2 ปีที่แล้ว

    Very well explained. Thank you for clarifying why it's beneficial to use. I feel like a lot of videos jump right over that.

  • @EduardoLima-pi7fl
    @EduardoLima-pi7fl 5 ปีที่แล้ว +7

    That's some great quality content! Thanks for sharing it bro, have a good day

    • @amigoscode
      @amigoscode  5 ปีที่แล้ว +1

      You too Eduardo. Thanks

  • @vdeschuy190
    @vdeschuy190 2 ปีที่แล้ว +5

    At 14:25 on line 17 when you are doing the ifPresent check, what is the difference between that and the null check at 0:20, which was a code smell?

    • @enlightened7354
      @enlightened7354 2 ปีที่แล้ว

      It seems oracle dudes love to make code look more difficult or instead of making code leas they love to make it too much. I say about dev of oracle. No doubts android leaving java . With all respect im a /learning java too. Why oracle wants code look verbose?

  • @AngelLeoserCastillo
    @AngelLeoserCastillo 3 ปีที่แล้ว

    I prefer using a enum and clause orElse inside de public Optional getEmail()
    Why did you prefer using on sout

  • @facundomartinez615
    @facundomartinez615 3 ปีที่แล้ว

    Thank you so much for your tutorials and explanations, im starting with java and this classes helps me really much. Awsome teacher. You have won a suscriber

  • @naoufalkharkhour6999
    @naoufalkharkhour6999 3 ปีที่แล้ว +1

    Amazing explanation!! Thank you Nelson.

  • @provokator-provocateur7603
    @provokator-provocateur7603 2 ปีที่แล้ว

    I watched video about same topic from Coding with John channel and I must say that he have the better desk.

  • @eliasalvest.i.646
    @eliasalvest.i.646 3 ปีที่แล้ว +2

    Gratidão, Mr. James, Show D+!!!!

  • @KentHervey
    @KentHervey 2 ปีที่แล้ว

    Thanks for doing this. I continue to learn from you on a regular basis!!

  • @nagarajanerode
    @nagarajanerode 3 ปีที่แล้ว

    Simple and obvious explanation ...

  • @abrehamish
    @abrehamish 4 ปีที่แล้ว

    Thank you Nelson for your valuable tutorial. I wish I knew you when I first started the java course.

  • @elmoutaouakkilmohammed1432
    @elmoutaouakkilmohammed1432 4 ปีที่แล้ว +3

    clear, concise and very well explained ! a deep thanks to Amigoscode :)

  • @kostiantynkarzhanov9216
    @kostiantynkarzhanov9216 8 หลายเดือนก่อน

    Thank you, great tutorial! Consice and well explained! 💛

  • @Roberto-lb5or
    @Roberto-lb5or 3 ปีที่แล้ว

    Your explanation is pretty clear. Thanks!

  • @jlac4745
    @jlac4745 4 ปีที่แล้ว +1

    Gracias hermano

  • @kirankumarsukumar
    @kirankumarsukumar 5 ปีที่แล้ว +3

    Well done brother

  • @andresencolombia
    @andresencolombia 2 ปีที่แล้ว

    Thank you very much. Very clear explanation.

  • @saidaraokotari2619
    @saidaraokotari2619 4 ปีที่แล้ว

    Great presentation.. Isn’t it costly to use optional with instance variables, each time we create an instance a new instance also requires for optional right

  • @duxiao5121
    @duxiao5121 4 ปีที่แล้ว +1

    简单明了,help me a lot.Thank you,谢谢

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว

      You are welcome Du

  • @erickballesteros4531
    @erickballesteros4531 3 ปีที่แล้ว

    love the new info... I actually had a ton of repetitive code that could've been solved with this

  • @brijeshpandey218
    @brijeshpandey218 4 ปีที่แล้ว +1

    better than many paid courses

  • @renejacques8288
    @renejacques8288 3 ปีที่แล้ว

    Did you use lambda expressions here, if so, does Optional use lambda by default?

  • @mikitamaskaliou7645
    @mikitamaskaliou7645 ปีที่แล้ว

    Cool explanation. Thank you😊

  • @MrAndykofi
    @MrAndykofi 3 ปีที่แล้ว

    Fantastic tutorial good friend, keep it up.

  • @mrfrog20110607
    @mrfrog20110607 4 ปีที่แล้ว +1

    Great video! Can we integrate the optional with Stream?

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว

      Yes of course check amigoscode.com

  • @ritikakapoor4583
    @ritikakapoor4583 ปีที่แล้ว

    Great tutorial! Thank you!

  • @subhrajeetmitra3681
    @subhrajeetmitra3681 3 ปีที่แล้ว

    For
    Optional obj = Optional.of("Hello");
    i am getting
    Type mismatch: cannot convert from Optional to Optional

  • @jopadjr
    @jopadjr 3 ปีที่แล้ว

    Thanks for the tutorial mate.. Cheers

  • @DanielSixl
    @DanielSixl 2 ปีที่แล้ว

    Thank you. Great explanation 😊

  • @dianagastrin6465
    @dianagastrin6465 4 ปีที่แล้ว

    Great explenation. very clear!
    thanks!

  • @aobaidi5626
    @aobaidi5626 3 ปีที่แล้ว

    Thanks very much, nice explanation!

  • @jaylawlmc1915
    @jaylawlmc1915 4 ปีที่แล้ว +5

    great tutorial indeed, but im having a hard time finding the holy grail of a tutorial that lets it click inside of me as to why optionals are *that* much better than null checks. i just don't get it :|

    • @trex4815
      @trex4815 4 ปีที่แล้ว +3

      I feel optional is mainly useful when we are dealing with chain of operations. Like chaining filter, map,flat-map operations on an optional object. Even if output of one stage is an empty object, it won't throw a runtime exception at next stage when we are calling a function on the empty object. So we do not need to check for exception at every stage. At the end we could use ifpresent method. this is the only scenario where i found this to be a bit useful compared to null check.

    • @cordovajose5693
      @cordovajose5693 4 ปีที่แล้ว

      It was added (along with a lot of other stuff) to support functional programming.

  • @OleksiiStarodub-z1y
    @OleksiiStarodub-z1y 3 ปีที่แล้ว

    Thank you for the video. Very usefull.

  • @rahulsinghai3033
    @rahulsinghai3033 4 ปีที่แล้ว

    Please make a series on reactive java if you have knowledge about it

  • @saintrivers962
    @saintrivers962 3 ปีที่แล้ว

    This was great help, man. Thanks a bunch.

  • @karinagaytan2162
    @karinagaytan2162 3 ปีที่แล้ว

    Goood explanation!! Awesome!

  • @anastasianaumko923
    @anastasianaumko923 ปีที่แล้ว

    Thanks! Great work!

  • @Overthought7
    @Overthought7 5 ปีที่แล้ว +1

    Very helpful! Thanks so much!

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว

      You welcome my friend

  • @davidleonardobernal61
    @davidleonardobernal61 4 ปีที่แล้ว

    Hello, is it a good practice to pass options as a parameter?

  • @akhil4519
    @akhil4519 2 ปีที่แล้ว

    How do you write a null and empty check for a string using optional ?

  • @yankomirov4290
    @yankomirov4290 5 ปีที่แล้ว +4

    Nice tutorial, helped a ton!

  • @npl4295
    @npl4295 4 ปีที่แล้ว

    thanks for explaining it well.

  • @zman14859
    @zman14859 2 ปีที่แล้ว

    Good explanation but, what if I want to return "Person"? How will that work with nullable?
    So say I make a get request and in the DB, no "Person" might exist

    • @inakiarias7465
      @inakiarias7465 2 ปีที่แล้ว

      Optional obj = Optional.ofNullable(db.getPerson());
      Something like that..?

  • @aobaidi5626
    @aobaidi5626 3 ปีที่แล้ว

    I cannot get, how we tackle this with POJO, as we dealing with JSON and Jackson ?

  • @stefanlarie2151
    @stefanlarie2151 3 ปีที่แล้ว

    what can Isay? best free tutorial for Optionals

  • @riadhchibani4929
    @riadhchibani4929 3 ปีที่แล้ว

    great quality

  • @pyramideddie7813
    @pyramideddie7813 4 ปีที่แล้ว +1

    Very useful, thank you very much!

  • @Jhironsel
    @Jhironsel ปีที่แล้ว

    Excelent...

  • @tempname7720
    @tempname7720 4 ปีที่แล้ว +1

    Nice tut. Suggestion, plz zoom when typing. I had to squint while watching

  • @yicai7
    @yicai7 4 ปีที่แล้ว

    Thanks for the great tutorial!

  • @lifeTechnicolorGuy
    @lifeTechnicolorGuy 5 ปีที่แล้ว +2

    Good as allways.

  • @goku6272
    @goku6272 3 ปีที่แล้ว

    hello , so whats the use of optional.of() if it does not able to handle null.

  • @alirez.rahimi
    @alirez.rahimi 3 ปีที่แล้ว +1

    thank you

  • @tammy55743
    @tammy55743 4 ปีที่แล้ว

    Super useful, thanks!

  • @StBrother42
    @StBrother42 4 ปีที่แล้ว +1

    Great job, man! Thank you!)

  • @SuperSilverJay
    @SuperSilverJay 4 ปีที่แล้ว +1

    So does this mean that imperative programming is becoming null?

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว +2

      No and never but sometimes there things that can be improved using functional programming

    • @SuperSilverJay
      @SuperSilverJay 4 ปีที่แล้ว

      Amigoscode oh okay that’s good to know. Are there any projects you’d recommend doing to practice streams/functional programming?

  • @BetterTomorrow
    @BetterTomorrow 3 ปีที่แล้ว

    Sir, will u plz make a complete video on lambda expressions.

    • @amigoscode
      @amigoscode  3 ปีที่แล้ว +1

      Waheed Khan there is one already

    • @BetterTomorrow
      @BetterTomorrow 3 ปีที่แล้ว

      @@amigoscode thanks Sir.
      Also make a tutorial on microservices. I got the job because of your tutorials.

  • @dan2thi
    @dan2thi 3 ปีที่แล้ว

    Great stuff!

  • @alessandroformica6824
    @alessandroformica6824 2 ปีที่แล้ว

    Thank you.

  • @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.

  • @priyankawagh5217
    @priyankawagh5217 4 ปีที่แล้ว

    Thanks for excellent video!

  • @josephwong2832
    @josephwong2832 4 ปีที่แล้ว +1

    Thanks a lot amigo!!!

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว

      You welcome Joseph

  • @yevhen.palamarchuk
    @yevhen.palamarchuk 4 ปีที่แล้ว

    Nice! Thank you very much!

  • @sdmj730
    @sdmj730 4 ปีที่แล้ว

    Thanks brother......

  • @jorgeantonio4208
    @jorgeantonio4208 3 ปีที่แล้ว

    Thank you, your video helped me a lot!!! :)

  • @oihfhuaotyha50670598
    @oihfhuaotyha50670598 4 ปีที่แล้ว

    Great Tutorial. Thank You :)

  • @lisali6205
    @lisali6205 2 ปีที่แล้ว

    Thank you so much

  • @Lumary
    @Lumary 2 ปีที่แล้ว

    Thanks a lot! 😊 🙌

  • @illiachalyk195
    @illiachalyk195 3 ปีที่แล้ว

    I love this!!!

  • @antonhen23
    @antonhen23 4 ปีที่แล้ว

    Super!

  • @АльфредГордан
    @АльфредГордан 4 ปีที่แล้ว +1

    thanks

  • @ollysalanson9452
    @ollysalanson9452 2 ปีที่แล้ว

    How do I use sout on Eclipse?

  • @yak_music
    @yak_music 2 ปีที่แล้ว

    what about OptionalInt ? can we sort a set of OptionalInt ?

  • @green-coder
    @green-coder 2 ปีที่แล้ว

    شكرا لك

  • @AliAlshishani
    @AliAlshishani 2 ปีที่แล้ว

    todo: redo all my projects using this

  • @Metachief_X
    @Metachief_X 3 ปีที่แล้ว

    TYY

  • @ollysalanson9452
    @ollysalanson9452 2 ปีที่แล้ว

    legend!

  • @saveUyghurs
    @saveUyghurs 3 ปีที่แล้ว

    Where is my comment was it deleted?

  • @reactjsdeveloper8758
    @reactjsdeveloper8758 3 ปีที่แล้ว

    Assalamualaikum brother

  • @Alberto_Cavalcante
    @Alberto_Cavalcante 2 ปีที่แล้ว

    👍

  • @aichabalde1952
    @aichabalde1952 4 ปีที่แล้ว

    That was very helpful thank you daddy😁❤

    • @amigoscode
      @amigoscode  4 ปีที่แล้ว

      you welcome cinhoooooo :)

  • @Humanbeing485
    @Humanbeing485 4 ปีที่แล้ว

    badhiya sikhata hai re tu kallumal :)

  • @TheKeyToMusicOfficial
    @TheKeyToMusicOfficial 3 ปีที่แล้ว

    i appreciate you babe

  • @NeusaLopesdeMendonca
    @NeusaLopesdeMendonca ปีที่แล้ว

    NelsonI like your tutorials man, but this one was messy. You didnt get to the basic fact that Optionals have a main purpose of telling the user that a value being returned might be null and he has to deal with it.

  • @dontknowwhattotypelo
    @dontknowwhattotypelo 5 ปีที่แล้ว +4

    порядочно пояснил

  • @maxshibanov818
    @maxshibanov818 4 ปีที่แล้ว +2

    Thank you for tutorial, but I don't like ASMR

  • @alexanderbell6330
    @alexanderbell6330 4 ปีที่แล้ว +1

    Great tutorial, thanks!

  • @shabinbharathan1106
    @shabinbharathan1106 2 ปีที่แล้ว

    Thank you

  • @pilarsolorzano9141
    @pilarsolorzano9141 3 ปีที่แล้ว

    Great tutorial! Thanks!!!