java - Switch default execution after return statement -


i'm using following code block, , bizarre issue that's happening though (i've confirmed breakpoints) first case hit, , contains return statement, default hit:

switch (sorttype)         {             case rating:                 return values.get(position - 1).getrating() != values.get(position).getrating();             case grape:                 return !values.get(position - 1).getgrape().equals(values.get(position).getgrape());             case region:                 return !values.get(position - 1).getregion().equals(values.get(position).getregion());             default:                 return !values.get(position - 1).getgrape().equals(values.get(position).getgrape());         } 

when default block running, sorttype rating. understand, return in first case should prevent default getting run. correct?

one of either line wrong based on return type:

case rating:             return values.get(position - 1).getrating() != values.get(position).getrating(); case grape:             return !values.get(position - 1).getgrape().equals(values.get(position).getgrape()); 

first 1 using != , second 1 using .equals(). suppose second 1 correct.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -