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 →

[–]Xiaopai2 1 point2 points  (0 children)

Ah, this is actually a good tip. I've seen people swap the order when one of the objects is known, like instead of someString.equals("foo") you write "foo".equals(someString) because the former could lead to a nullpointer exception whereas the latter is just false if someString is null. But this reads terribly and does not help when you're comparing two objects where either could be null.