home.social

#java19 — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #java19, aggregated by home.social.

  1. #17: Custom Localized Date-Time Formats

    You can have a `DateTimeFormatter` with a custom pattern: `ofPattern("y-MM-dd")`

    You can have a localized one, too:
    `ofLocalizedDate(FormatStyle.SHORT)`

    And since #Java19, custom localized one works, too: `ofLocalizedPattern("yMM")`

  2. #5: `newHashSet`

    The `HashSet` constructor that takes an `int` argument interprets that as capacity, not as the number of expected elements. Once the number of elements reaches $LOAD-FACTOR (by default 75%) of capacity, the set resizes itself.

    To avoid that resize with the constructor you either need to compute capacity from number of expected elements or set the load factor accordingly.

    Or, since #Java19, call `HashSet::newHashSet` and pass the number of expected elements.

  3. Lots of learning to be had at the return of the #Belgian Java User Group where the great @ammbra1508 talked about new features in #Java 19 . Kudos to @TCoolsIT and @ohubaut for reviving (resuscitating?) the group 👏 And nice to see @geoffreydesmet there as well 🙂

    RT @[email protected]

    After a short intro, our star speaker of the evening is kicking it all off! @ammbra1508 talking about #java19.

    #JUG

  4. We use #jlink and #jpackage to distribute @cryptomator. This makes the #JDK only a build time requirement. Users don't need to install #Java separately.

    The challenge: During a #PPA build (for our users of #Ubuntu based distros) one may only depend on existing software. No downloads allowed. The latest #OpenJDK version in Ubuntu Focal is 17. But we still want to use #Java19.

    The solution is to create an intermediary PPA which is allowed as build dependency: launchpad.net/~coffeelibs/+arc

  5. Just a single day to go until J-Fall! For the 6th consecutive time I'll be speaking at the largest #Java event in my home country. 🇳🇱 At 8AM in Room 5 @peterwessels, me & a room full of early birds will dive into #PatternMatching! #Java19 #JFall

  6. A while ago, I committed a patch to the #OpenJDK, which is now included in #Java19. It kills unnecessary allocation of byte[] during certain types of decryption, such as AES-CTR.

    I did some before-and-after tests using JFR, decrypting 4 GiB. On JDK 17 you can see 4 GiB of allocations and plenty of GC pauses (the orange vertical bars). On JDK 19 you see virtually no allocations at all (note the different scale on the y axis).

    Test case: gist.github.com/overheadhunter

    #java #performance #encryption