• nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    Who needs chocolate when they can have Java features in their advent calendar? (Yes, I'm late, but fashionably so. 😋) From language features to API additions, from tooling to performance, here are 24 Java features you missed in 2022! As 📺: youtube.com/watch?v=ghGvFc… As 🧵: 👇🏾

    5 46 139 0 57
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #1: Structured Concurrency Debugging When you do structured concurrency, you create parent-child relationships between your threads that are visible in thread dumps and to debuggers. See @intellijidea screenshot what that can look like. This is a game changer for debugging!

    nipafx tweet picture

    1 1 13 0 1
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #2: `Future` The interface got 3 new methods: * `exceptionNow()` to immediately return the task's exception * `resultNow()` to immediately return the task's result * `state()`: CANCELLED, FAILED, RUNNING, or SUCCESS First two throw `IllegalStateException` if in wrong state.

    1 0 3 0 0
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #3: `ForkJoinTask` 2 new methods: * `quietlyJoin(long timeout, TimeUnit unit)` tries to join the task before the given timeout * `quietlyJoinUninterruptibly(long timeout, TimeUnit unit)` same but can't be interrupted (Tbh, the 2nd one seems shady, but that's just gut feeling.)

    1 0 2 0 0
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #4: `ForkJoinPool` 2 new methods: * `lazySubmit(ForkJoinTask<T> task)` to submit tasks that you don't *need* to execute if contention is high (i.e. they may never run) * `setParallelism` to set the pool's target parallelism after creation 1st one is very interesting.

    nipafx tweet picture

    1 0 3 0 0
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

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

    nipafx tweet picture

    1 1 6 0 0
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #6: `newHashMap` ... you either need to compute capacity from number of expected elements or set the load factor accordingly. Or, since #JDK19, call `HashSet::newHashSet` and pass the number of expected elements. Likewise, there's `HashMap::newHashMap`.

    nipafx tweet picture

    1 0 5 0 0
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    I need to take a break here. I did not get enough sleep last night (editing the video took too long) and am too tired to tweet more. 🥱 I'll keep adding to this thread over the next days until I catch up with the calendar 🗓️ and will then continue with one tweet per day...

    1 0 8 0 1
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #7: GitHub Action oracle-actions/setup-java works like actions/setup-java with a few differences: * supports EA builds from projects like Loom, Panama, etc. * better handling of EA builds in general * support for Oracle JDK More details: inside.java/2022/03/11/set…

    nipafx tweet picture

    1 1 4 2K 0
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #8: `Vector::compress` In #JDK19, `compress` was added to the incubating vector API. Called on a vector with a mask... var reds = rgbVector .compress(redMask); ... it selects the lanes where the mask is true and stores them in a contiguous block in the result vector.

    nipafx tweet picture
    nipafx tweet picture
    keyboard_arrow_left Previous keyboard_arrow_right Next

    1 0 3 1K 0
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #9: `Vector::expand` This is the dual operation to `compress`. Starting at index zero of the input vector, it stores each value in the output vector's lane at the next position where the mask is true. Other lanes are set to zero (oh, `compress` also sets remainder to zero).

    1 0 3 2K 0
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    Bonus! If you think of an integer as a vector with 32 bits, then compressing/expanding applies here, too. And the mask is 32 booleans/bits, i.e. also an integer. Hence, `Integer` got this static method: int compress(int i, int mask) Similarly, `expand` and same on `Long`.

    nipafx tweet picture
    nipafx tweet picture
    keyboard_arrow_left Previous keyboard_arrow_right Next

    1 0 4 2K 1
    Download Image
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #10: Suppress Doclint Warnings Do you write Javadoc? 👍 Do you use Doclint? 👍 Do you fix all warnings? 😬 You can now suppress Javadoc-related warnings, e.g.: // suppress all @​SuppressWarnings( "doclint") // suppress syntax warnings @​SuppressWarnings( "doclint:syntax")

    1 0 1 1K 0
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    3 years ago

    #11: More String Deduplication On average, ~25% of heaps are char arrays for strings and roughly half of them are duplicates. 😳 Since 2017, G1 deduplicates them, which saves ~10% heap size. Other GCs followed suit: #JDK17: Shenandoah #JDK18: ZGC, Serial GC, and Parallel GC

    1 0 6 2K 0
  • Download Image
    • Privacy
    • Term and Conditions
    • About
    • Contact Us
    • TwStalker is not affiliated with X™. All Rights Reserved. 2024 www.instalker.org

    twitter web viewer x profile viewer bayigram.com instagram takipçi satın al instagram takipçi hilesi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al sosyalgram takipçi satın al instagram ücretsiz takipçi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al metin2 metin2 wiki metin2 ep metin2 dragon coins metin2 forum metin2 board popigram instagram takipçi satın al takipçi hilesi twitter takipçi satın al tiktok takipçi satın al tiktok beğeni satın al tiktok izlenme satın al beğeni satın al instagram beğeni satın al youtube abone satın al youtube izlenme satın al buyfans buy instagram followers buy instagram likes buy instagram views buy tiktok followers buy tiktok likes buy tiktok views buy twitter followers buy telegram members Buy Youtube Subscribers Buy Youtube Views Buy Youtube Likes forstalk postegro web postegro x profile viewer