I am pretty sure there is a common idiom, but I couldn\'t find it with Google Search...
Here is what I want to do (in Java):
Here is an example that checks if a list contains all zeros:
x = [0, 0, 0] all(map(lambda v: v==0, x)) # Evaluates to True x = [0, 1, 0] all(map(lambda v: v==0, x)) # Evaluates to False
Alternative you can also do:
all(v == 0 for v in x)