Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
None
Description
In the api of class map, is the example in the description for the method dropWhile(Closure closure) incorrect.
http://groovy.codehaus.org/groovy-jdk/java/util/Map.html#dropWhile(groovy.lang.Closure)
def shopping = [milk:1, bread:2, chocolate:3] assert shopping.takeWhile{ it.key.size() < 6 } == [milk:1, bread:2] assert shopping.takeWhile{ it.value % 2 } == [milk:1] assert shopping.takeWhile{ k, v -> k.size() + v <= 7 } == [milk:1, bread:2]
It must be
def shopping = [milk:1, bread:2, chocolate:3] assert shopping.dropWhile{ it.key.size() < 6 } == [milk:1, bread:2] assert shopping.dropWhile{ it.value % 2 } == [milk:1] assert shopping.dropWhile{ k, v -> k.size() + v <= 7 } == [milk:1, bread:2]