Java 21 API New Features

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

Комментарии •

  • @java
    @java  Год назад +39

    We got 2:34 wrong. Named groups in regular expressions are supported since Java 7. What's new (in 20) is that the methods related to named groups moved up the dependency tree from `Matcher` to the interface `MatchResult`.

    • @zoladkow
      @zoladkow Год назад +3

      no worries, everyone here knows the vids are just about coffee sipping with some words inbetween 😁

    • @brandpcalderon5343
      @brandpcalderon5343 10 месяцев назад +1

      i was going to complain the same, named groups are allowed since I learnt regex like 3 years ago and more I suppose

    • @OzoneGrif
      @OzoneGrif 8 месяцев назад +1

      Yeah I was really confused about this. Was going to comment the same thing. Brain fart !

  • @onebeartoe
    @onebeartoe Год назад +9

    Thanks! I cant wait for the named String groupings to help parse flat files.

  • @YvesDautremay
    @YvesDautremay Год назад +8

    Thanks for the overview ! A few nice things that may be shadowed by virtual threads

  • @Talaria.School
    @Talaria.School Год назад +5

    Great topics I had to comment and thumbs up.
    Thanks a lot José.

  • @boyneverstop
    @boyneverstop Год назад +5

    Thank you for making this video! Very useful

  • @1gmar
    @1gmar Год назад +12

    Apologies, isn't the feature mentioned at 2:34 already available since Java 7?

    • @mikolajpodbielski
      @mikolajpodbielski Год назад

      Yes, it is.

    • @christofferhammarstrom
      @christofferhammarstrom Год назад +4

      What is new in Java 20 though, is that MatchResult now supports named groups. Perhaps there was a mixup here.

    • @JosePaumard
      @JosePaumard Год назад +6

      You're absolutely right. What has been done in 20 is that the methods are now available on MatchResult (interface implemented by the Matcher class), along with some others. I should have mentionned namedGroup() also.

  • @OriginGaming101
    @OriginGaming101 4 месяца назад +2

    Came here for Java, stayed for their use of my favourite local cafe in the background! 😂

  • @nO_d3N1AL
    @nO_d3N1AL Год назад +1

    Really appreciate this format of doing updates. Also a cool idea: the amount of coffee left in the cup should match the progress of the video ;)
    Also thankful that new APIs and methods aren't using checked exceptions! 🎉

    • @JosePaumard
      @JosePaumard Год назад +1

      Well it does ;) This is real coffee that I drink during the recording.

    • @nO_d3N1AL
      @nO_d3N1AL Год назад

      @@JosePaumard Cool! I bet it's actual Java coffee too ;)

    • @JosePaumard
      @JosePaumard Год назад +1

      @@nO_d3N1AL Oh yes it is! 😊

  • @codeZarathustra
    @codeZarathustra Год назад +4

    Good explanation Sr! Thank very much!

  • @jeromemainaud
    @jeromemainaud 7 месяцев назад

    3:59 With large patterns in a multiline string, instead of using backslashes you can also use the COMMENT flag. This will be more readable.

  • @svalyavasvalyava9867
    @svalyavasvalyava9867 Год назад +1

    Awesome video, thank you ☺️

  • @mortensen117
    @mortensen117 Год назад +2

    So, named groups, which arrived in Java SE 7, is now suddenly something new?
    If you could write the name of the group in some meaningfull way without of a lot a string gymnastics, then there would be some thing new.

    • @JosePaumard
      @JosePaumard Год назад +2

      What is new is that the methods are now also on the interface.

  • @hephestos300
    @hephestos300 8 месяцев назад

    after what JDK will be the whole lambda as was introduced in JDK8 deprecated and ousted ? Can't wait the moment

  • @zenmony-dot-com7457
    @zenmony-dot-com7457 Год назад +2

    Pleasant coffee lounge atmosphere, perfect for learning.

  • @ajaypt1947
    @ajaypt1947 Год назад

    thank you for valuable information sir...
    btw I like ur coffee cup

  • @RajinderYadav
    @RajinderYadav Год назад

    legend has it this guy is still sipping his coffee and hasn't finished it

    • @ggunlistedarchive969
      @ggunlistedarchive969 10 месяцев назад

      He did finish his coffee at the end of the episode 😅

    • @MrSpyTubes
      @MrSpyTubes 9 месяцев назад

      Another legend says that the cafeteria behind is a green screen and he is actually in a pub, and that's not coffee in the glass but Guinness

  • @oifbert
    @oifbert 6 месяцев назад

    What's new about pattern matching? Named groups have existed for years.

  • @Speiger
    @Speiger Год назад +2

    IMO the state enum is missing something.
    "CREATED" or "UNSTARTED", because there is no way to track if a task was already started or not.
    Which is useful if you have a queue of tasks that are expensive and you want to cut basically anything that isn't started yet, and you didn't expose the Queue itself.
    Unless state returns null if it isn't started yet, then i take that back.

    • @pravinjain2834
      @pravinjain2834 Год назад

      I fully agree, currently it seems they put the state as RUNNING as soon as the task is submitted.
      probably it is being thought that since we can have virtual threads, the number of threads in the pool will be more and no task will be waiting to get started. but for tasks which are computative (no blocking activity), one may not like to use virtual threads.
      In any case you are right, that state has been missed.

  • @ahmadfx8962
    @ahmadfx8962 Год назад

    رائع

  • @si2001si
    @si2001si 11 месяцев назад

    Hi Jose, Big Fan!! Your Coffee looks yum

  • @ClydeXT
    @ClydeXT Год назад

    In your example at 7:15, your types should be "byte[]" instead if "int[]"

    • @zoladkow
      @zoladkow Год назад

      ahh... certainly too much coffee 🙃

  • @TheNeoxpert
    @TheNeoxpert Год назад

    08:44 close() method will be called no matter what? what if there is System.exit(0); in the try block?

    • @JosePaumard
      @JosePaumard Год назад +1

      Nope, not in that case. If what you need is to kill your JVM as fast as possible, taking the time to execute all your close(), finalize(), etc... would probably be a mistake,

  • @danthe1st
    @danthe1st Год назад +2

    Shouldn't it be "Charset" instead of "CharSet" in 7:09?

    • @muzzletov
      @muzzletov Год назад +1

      CharSet is just short for Character Set. So, no, it shouldnt.But yes, the class is called Charset, which feels wrong :D

    • @danthe1st
      @danthe1st Год назад

      @@muzzletov If the JDK calls it Charset, it is Charset and not CharSet. And honestly, I would consider charset to be its own (atomic) word and (at least in the context of Java,) it isn't really a set of characters.

    • @JosePaumard
      @JosePaumard Год назад

      It should. Thank you for pointing it out!

  • @edmaphis9805
    @edmaphis9805 Год назад

    Emoji methods !!
    Holy smokes !!

  • @computer_science10
    @computer_science10 Год назад

    thank you

  • @rishiraj2548
    @rishiraj2548 5 месяцев назад

    Thanks

  • @radoandrey2268
    @radoandrey2268 Год назад

    Thank you

  • @RishiRajxtrim
    @RishiRajxtrim 4 месяца назад

    🎉

  • @edmaphis9805
    @edmaphis9805 Год назад

    So Autoclosable is a functional interface?

    • @JosePaumard
      @JosePaumard Год назад +1

      It is. I'm not sure that it will be very useful to implement it with a lambda though...

    • @edmaphis9805
      @edmaphis9805 Год назад

      Ok.
      class Closer {
      static void closing(Closeable closeable) throws Exception {
      System.out.println("Now closing: " + closeable.toString());
      closeable.close();
      }
      }
      class AClosable implements AutoCloseable {
      @Override
      public void close() throws Exception {
      System.out.println("I am closing");
      }
      }
      public class CloseableDemo {
      public static void main(String[] args) throws Exception {
      var aclosable = new AClosable();
      Closer.closing(() -> {
      try {
      aclosable.close();
      } catch (Exception ex) { }
      });
      }
      }

    • @edmaphis9805
      @edmaphis9805 Год назад

      @@JosePaumard Thanks, I tried anyhow. 😉

    • @JosePaumard
      @JosePaumard Год назад +2

      @@edmaphis9805I'm not sure I would use this pattern in a real application 😉

  • @JorgetePanete
    @JorgetePanete Год назад +1

    I think close() should be called automatically when the object is no longer needed

    • @SourabhBhat
      @SourabhBhat Год назад +6

      Wouldn't that cause the same problems as finalize?

    • @JorgetePanete
      @JorgetePanete Год назад

      @@SourabhBhat At least if it's called at the end of the scope of the object I think there wouldn't be problems

    • @alessandroautiero5414
      @alessandroautiero5414 Год назад +2

      ​​@@JorgetePanetein a method's scope that's probably easy enough (GoLang has the defer keyword for this use case pretty much), but how would you do it in the case of a field? It would have the same problems as the finalize method I'm pretty sure.

    • @JorgetePanete
      @JorgetePanete Год назад

      @@alessandroautiero5414 I don't know, I just wish it was like Rust does

    • @mattidragon835
      @mattidragon835 Год назад +2

      @@JorgetePanete the reason rust can automatically close is it's strict borrowing and moving rules. In java you can move objects freely and rely on the GC to clean them up

  • @akaalkripal5724
    @akaalkripal5724 Год назад

    How's the coffee?

  • @JoshuaMuzaaya
    @JoshuaMuzaaya 11 месяцев назад

    wow, all these have been in Erlang/OTP, Python, Elixir right at those languages' first version.

  • @sneibarg
    @sneibarg Год назад +1

    Naming capture groups is a super old feature of Python.

  • @kitkarson4226
    @kitkarson4226 Год назад +2

    Why do they pollute Character class with emoji methods 🤮? They could have made it as a separate util class .

    • @pravinjain2834
      @pravinjain2834 Год назад

      Yes, there could be a separate class for all the Unicode properties. There are still a lot of unicode properties not available in Java API (Character class).

  • @Parkhill57
    @Parkhill57 Год назад

    piano in background still drives me crazy.

  • @mortensen117
    @mortensen117 Год назад +1

    AutoCloseable?
    Why are you presenting these OLD features as if they were new? Are you crazy?

    • @kitkarson4226
      @kitkarson4226 Год назад +12

      Watch it one more time. AutoCloseable is OLD. But now ExecutorService, HttpClient..etc also implement the interface. Thats what he says!

    • @JosePaumard
      @JosePaumard Год назад +2

      It's not because it's old that it's not useful. With the deprecation of finalize(), AutoCloseable becomes more important. Thus the new classes that implement it.
      Keeping repeating old stuff is not a problem for me.

  • @nicholas1460
    @nicholas1460 Год назад +1

    You used var. Shame on you.

    • @JosePaumard
      @JosePaumard Год назад +8

      Oh no, I love var.

    • @nicholas1460
      @nicholas1460 Год назад

      @@JosePaumard var var var var. Just for you. Quess what objects I'm using.

    • @JosePaumard
      @JosePaumard Год назад +3

      @@nicholas1460 You don't need to use it everywhere. But there are still many places where it will make your code more readable.

    • @kitkarson4226
      @kitkarson4226 Год назад +3

      var is a great addition to java. I have been using for couple years now,

    • @khmarbaise
      @khmarbaise Год назад

      var often shows that the variables names used are not good enough to transport the information. That lets me reconsider my names and make it better (hopefully ;-))

  • @Kjhd9987hy
    @Kjhd9987hy Год назад

    What an old ugly mess language. I feel bad for android devs when they gota look at swift and swiftui