Java in operator
问题 For the one millionth time, I would have liked to use an IN operator in Java, similar to the IN operator in SQL. It could just be implemented as compiler syntactic sugar. So this if (value in (a, b, c)) { } else if (value in (d, e)) { } ...would really be awesome. In fact, the above is the same as the rather verbose (and not adapted for primitives) construct here: if (Arrays.asList(a, b, c).contains(value)) { } else if (Arrays.asList(d, e).contains(value)) { } Or like this for int , long and