Live data from Hacker News

Yoda conditions

en.wikipedia.org

1–10 of 116 posts

Re: Yoda conditions

#3

Ahh... The good 'ol technique for avoiding NPEs in Java.

For those who are wondering what this refers to, it is writing code like this:

    "foo".equals(myVar)
instead of writing:

    myVar.equals("foo")
which could can cause NullPointerException if myVar is null.

Re: Yoda conditions

#4
Am I sure pretty any that linter warning a throw can of instead breaking flow the both of reading writing and.

Re: Yoda conditions

#5

Ahh... The good 'ol technique for avoiding NPEs in Java.

For those who are wondering what this refers to, it is writing code like this: "foo".equals(myVar) instead of writing: myVar.equals("foo") which could can cause NullPointerException if myVar is null.

[deleted]

Re: Yoda conditions

#6

Ahh... The good 'ol technique for avoiding NPEs in Java.

For those who are wondering what this refers to, it is writing code like this: "foo".equals(myVar) instead of writing: myVar.equals("foo") which could can cause NullPointerException if myVar is null.

you've missed a closing " which makes this read differently than intended

Re: Yoda conditions

#10
post #6

Earlier quoted context omitted.

For those who are wondering what this refers to, it is writing code like this: "foo".equals(myVar) instead of writing: myVar.equals("foo") which could can cause NullPointerException if myVar is null.

you've missed a closing " which makes this read differently than intended

Thanks. Fixed now.
Post reply on HN