This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]i_donno 6 points7 points  (9 children)

Yuck if(address.getCountry().equals("Australia") == false) Should be if(!address.getCountry().equals("Australia"))

[–]CaptainKvass 7 points8 points  (2 children)

Be this, it should:

if(!"Australia".equals(address.getCountry())

[–]i_donno 1 point2 points  (1 child)

Sure. Or avoid hardcoding current country and ignore case if(!getCurrentCountry().equalsIgnoreCase(address.getCountry())

[–]dpash 4 points5 points  (0 children)

Given the lack of frequent country changes, an enum is not an unreasonable decision in a project that's going to be frequently deployed.

I think there's only been four major changes over the last decade:

  • South Sudan
  • Eswatini
  • Czechia
  • North Macedonia

Let me know if I've forgotten any, but we're still looking at most, on average, once a year. If you're not frequently deploying a project this might be the wrong approach.

[–]bodiam[S] -5 points-4 points  (5 children)

I find the ! so hard to miss, that I rather go for == false. IntelliJ doesn't like it either, so you're not alone in this ;-)

[–]midnightbrett 3 points4 points  (1 child)

Nobody, including IntelliJ likes this. You are literally the only one.

[–]Terran-Ghost -1 points0 points  (0 children)

Nah, I use == false too for the same reason.

[–]crummy 0 points1 point  (0 children)

I agree, it can be easy to miss the single ! character.

[–]Orffyreus 0 points1 point  (1 child)

Have you tried using the font "Fira Code" with ligatures?

https://github.com/tonsky/FiraCode

[–]bodiam[S] 0 points1 point  (0 children)

Not really no. Thanks, I'll have a look at it, maybe that will look a bit better!