I'm a python programmer who is learning java
I ran across the following problem (or maybe complication is a better term to use)
In python, I can easily check if an item is in a list within an if statement like so:
x = 1
if x in [0,1,2,3,4,5]:
#do something
what is the easiest way to do that in java?
- can I do it without using a list variable like in the example above?
e.g
{0,1}.contains(1)
(not sure if this is a duplicate, I did look, if it is be sure to flag it for =)