Original code:
if (!externals.containsKey(query.getName())) {
I need to check also if query.getName() != "manualPrice" so my code becomes:
if ((!externals.containsKey(query.getName())) && (query.getName() != "manualPrice")) {
this isn't giving me the desired result. I'm not getting errors but the page isnt loading.
However annoyingly enough this code does work (it just doesnt feel as neat):
if (!externals.containsKey(query.getName())) {
if (query.getName() != "manualPrice") {
is there something really obvious I'm missing out. Im not normally at Java developer but do know C# which is pretty similar from what I've seen. Im hoping its just something silly I've missed.
cheers
UPDATE *****
ok so people have pointed out that rather than == i should be using .equals
which I have done. my new code is:
if ((!externals.containsKey(query.getName())) && (!query.getName().equals("manualPrice"))) {
which still gives the same error as it did with the ==
I'm begrudgingly using the nested if method for now but its just got me baffled as to what could possibly be wrong with it. It compiles fine!