Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Won't Fix
-
2.3.8, 2.4.0-beta-4
-
None
-
None
Description
assert [].every() assert [].every { it } assert [].every { it > 1 }
Is this an expected behavior? In all the variants of every() in DefaultGroovyMethods the logic is simlar to
BooleanClosureWrapper bcw = new BooleanClosureWrapper(closure); for (Iterator iter = InvokerHelper.asIterator(self); iter.hasNext();) { if (!bcw.call(iter.next())) { return false; } } return true;
So it defaults to true if !iter.hasNext(). Is this acceptable? Shouldn't it falsify based on empty List fails Groovy Truth?