Better Java Streams with Gatherers - Inside Java Newscast #57

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

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

  • @kinsleykajiva
    @kinsleykajiva 11 месяцев назад +4

    Thank you for explaining this as well !

  • @thoriig3887
    @thoriig3887 11 месяцев назад +6

    Looking forward for 461 since Viktor Klangs session about it at devoxx in belgium. making streams so much more versatile and flexible. glad that it gets more love now ❤ kudos to Viktor and you. a major gain for jdk development 🖖

    • @nipafx
      @nipafx 11 месяцев назад +2

      Thank you! Positive feedback like this (for both the JEP and the video) is always appreciated. 😊

  • @tachyba
    @tachyba 11 месяцев назад +6

    The idea seems very promising, can't wait for it!

  • @prdoyle
    @prdoyle 11 месяцев назад +2

    This is big news! Thanks for sharing it!

  • @npexception
    @npexception 11 месяцев назад +7

    I've been hoping for something like this to come to Java ever since I started enjoying the many variations of sequence manipulations in Clojure. Can't wait to finally get similar flexibility in Java! :)

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

      @npexception do you use both at your current job, or just java ?

  • @matyas94k
    @matyas94k 11 месяцев назад +7

    Well, we now need a JEP for Stream Hunters ('dunno, maybe something running on a daemon thread and yielding some specific elements when processing marked streams on the main thread), so we can declare that the Streams API evolved into a hunter-gatherer stage. :D

    • @nipafx
      @nipafx 11 месяцев назад +2

      I'll forward this to Viktor (who's idea gatherers are) - let's see whether he can come up with something. 😂

  • @heinrich3427
    @heinrich3427 11 месяцев назад +4

    Great addition to the API. It could basically replace all intermediate operations on a Stream. mapMulti, added in 16, already looks like legacy because it is a subset of what Gatherers will provide. A little bit unfortunated.

    • @nipafx
      @nipafx 11 месяцев назад +2

      Good point on `mapMulti` - it really feels like a (weak) precursor to gatherers.

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

    Thank you

  • @derrickheng564
    @derrickheng564 11 месяцев назад +2

    Keep up the good work Nick!

    • @nipafx
      @nipafx 11 месяцев назад +1

      Thanks, I will. 😊

  • @FriendlyNeighbourlyPerson
    @FriendlyNeighbourlyPerson 11 месяцев назад +2

    I don't understand it. Sounds like it does the same thing as filter

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

      Do you know what a filter does?

    • @nipafx
      @nipafx 11 месяцев назад +4

      A Gatherer can do all kinds of things. It's easy to implement a filter with it - see 2:26. But you can also implement a bunch of other behaviors. A lot are mentioned throughout the rest of the video. If you want to better understand how that works, check out the companion video on my channel (link in the video description).

    • @prdoyle
      @prdoyle 11 месяцев назад +4

      Perhaps try implementing limit() using filter.

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

    8:55 Where did the mapper come from?

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

      You mean 2:55, right? The code I show here is somewhat incomplete, so it fits on screen. All gatherers I show would have to be built in and returned from a factory method that takes arguments like the `nrOfElements` for `limit` and `mapper` for `map`. You can see this hinted at in the comment above the snippet I show. To see the full code: github.com/nipafx/demo-java-x/blob/main/src/main/java/dev/nipafx/demo/java_next/api/gather/CustomGatherers.java#L90-L97

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

    haha for that mistake the gatherer will FINISH YOU 😂

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

    I dunno, thats definitely more lively than coffee sipping, but too much gesticulation makes it hard to follow. I don't think java needs to try this hard to be hip 🤷
    Also, would help a lot if it wasn't just one channel, because now we get a mix of different content delivery and presentation styles, while, in some cases, also covering same topics. Whoever would want to see it all, could still subscribe to them all.
    Got coffee fetish? - go see this distinguished gentleman showing how blissfully he can sip. Got ADHD? - go see a dude armwrestling for your attention.
    LTT got it right - it seems they have a channel for each taste of content 😁🙃

    • @nipafx
      @nipafx 11 месяцев назад +1

      Ouch. I'm not trying anything, it's just who/how I am. 😢
      We've been considering having several channels for a while now but there are lots of considerations on both sides of that argument and I don't think we're gonna do it.