[bisq-network/bisq] Trade protocol domain improvements (#4566)
chimp1984
notifications at github.com
Sun Sep 27 07:15:28 UTC 2020
@ripcurlx can you deactivate the enforced equals check for enums in codacy?
Compare with == better for enums than equals.
https://stackoverflow.com/questions/1750435/comparing-java-enum-members-or-equals
```
enum Color { BLACK, WHITE };
Color nothing = null;
if (nothing == Color.BLACK); // runs fine
if (nothing.equals(Color.BLACK)); // throws NullPointerException
```
```
enum Color { BLACK, WHITE };
enum Chiral { LEFT, RIGHT };
if (Color.BLACK.equals(Chiral.LEFT)); // compiles fine
if (Color.BLACK == Chiral.LEFT); // DOESN'T COMPILE!!! Incompatible types!
```
"To summarize, the arguments for using == on enum are:
It works.
It's faster.
It's safer at run-time.
It's safer at compile-time.
"
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4566#issuecomment-699596657
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200927/b84e4201/attachment.html>
More information about the bisq-github
mailing list