• nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    2 years ago

    How do you name unused variables? If even just having to make that choice annoys you (it's not just me, right?), read on for how #JavaNext will fix that and make pattern matching (how's that related?!) more maintainable in the process. 🧵

    22 14 28 49K 5
  • nipafx Profile Picture

    Nicolai Parlog 🇺🇦🕊️ @nipafx

    2 years ago

    TL;DR: Unused variables suck. They're rare now, but will be more prevalent soon. JEP 443 proposes to replace them with _ for cleaner code and better pattern matching. "This 🧵 should've been 📰" ⇝ nipafx.dev/inside-java-ne… "This 🧵 should've been 📽️" ⇝ youtube.com/watch?v=nP1k41…

    1 3 11 2K 2
  • konrbk Profile Picture

    Konrad @konrbk

    2 years ago

    @nipafx __

    1 0 5 318 0
  • ImThiyagarajan7 Profile Picture

    Thiyagarajan @ImThiyagarajan7

    2 years ago

    @nipafx map.computeIfAbsent(key, ignoreMe -> new ArrayList<>());

    2 0 2 393 0
  • GeoffreyDeSmet Profile Picture

    Geoffrey De Smet @GeoffreyDeSmet

    2 years ago

    @nipafx @ammbra1508 Is it ok to use this for Map.computeIfAbscent()? String name = ...; map.computeIfAbscent(name, _ -> new Person(name)); Or is better to do this? map.computeIfAbscent(name, name2 -> new Person(name2));

    1 0 2 509 0
  • KlemensMorbe Profile Picture

    KlemensMorbe @KlemensMorbe

    2 years ago

    @nipafx I usually delete unused variables 🤔 who keeps them ans why?

    1 0 0 188 0
  • deviousJoke Profile Picture

    Adam Dymek🇪🇺🇺🇦 @deviousJoke

    2 years ago

    @nipafx I use "_" and then cry it doesn't pass the syntax check, and then cry some more.

    1 0 0 50 0
  • mini_JUG Profile Picture

    miniJUG @mini_JUG

    2 years ago

    @nipafx I'm from the future and I use _

    1 0 0 149 0
  • lkasmbdee Profile Picture

    Gel Natoyant, A.A. @lkasmbdee

    2 years ago

    @nipafx @java "peepeepoopoo"

    1 0 0 46 0
  • yaftu Profile Picture

    HANNES 🇪🇺🇦🇹 @yaftu

    2 years ago

    @nipafx What are unused variables?

    0 0 0 168 0
  • Stephan007 Profile Picture

    Stephan Janssen ☕️🧠🧞‍♂️ @Stephan007

    2 years ago

    @nipafx @JosePaumard _ 🤪

    0 0 2 166 0
  • kevinb9n Profile Picture

    Kevin Bourrillion @kevinb9n

    2 years ago

    @nipafx In Google, naming these `unused*` makes them exempt from our unused-variable checker. This is a better approach than `@ SuppressWarnings` because if it does become used the user will rename it and won't have some cruft to remember to go back and clean out.

    2 0 2 676 0
  • grossws Profile Picture

    Konstantin Gribov @grossws

    2 years ago

    @nipafx Usually just _unused for generic case, _ignored for exceptions, _k/_key for computeIfAbsent. With ide configured to suppress warning names prefixed with underscore

    0 0 1 41 0
  • GaelJourdanWeil Profile Picture

    Gaël Jourdan-Weil @GaelJourdanWeil

    2 years ago

    @nipafx @java I'm used to _ in Scala. Happy to see that it could be the same in Java.

    0 0 0 67 0
  • FlavienCharlon Profile Picture

    Flavien Charlon @FlavienCharlon

    2 years ago

    @nipafx Funny how Java is always 10 years behind C#

    0 0 0 91 0
  • turbanoff Profile Picture

    turbanoff @turbanoff

    2 years ago

    @nipafx Usually $ ``` locks.computeIfAbsent(key, $ -> new ReentrantLock()); ```

    1 0 0 105 0
  • phaidinyak Profile Picture

    Pete Haidinyak @phaidinyak

    2 years ago

    @nipafx @java Gone

    0 0 0 47 0
  • GawedaTomasz Profile Picture

    Tomasz Gawęda 🇵🇱 @GawedaTomasz

    2 years ago

    @nipafx "_" is the best in this context.

    1 0 0 134 0
  • peter_pb_becker Profile Picture

    Peter Becker @peter_pb_becker

    2 years ago

    @nipafx I name such variables "ignore".

    0 0 0 80 0
  • Burl21 Profile Picture

    Cristian Bur @Burl21

    2 years ago

    @nipafx ignored

    0 0 0 102 0
  • CraigEwert Profile Picture

    Craigeroonie @CraigEwert

    2 years ago

    @nipafx @java normally. I don't us it today, but that doesn't mean I won't use it tomorrow.

    0 0 0 17 0
  • gopinnath Profile Picture

    Gopinath Radhakrishnan @gopinnath

    2 years ago

    @nipafx InjectMocks needs it

    0 0 0 103 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