I think groovy's findAll would work nicely here rather than looping So if findAll zeroes equals the f.size then you know it's all zeroes.