Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.6.1
-
None
-
N/A
Description
The documentation for the sort method in Collection says that if this method is called with a closure, the closure must return the result of comparison. However, I think this text is applicable when the closure has 2 parameters. When the closure is used with 1 parameter in the closure, the closure must return a Comparable object.
Link to documentation: http://groovy.codehaus.org/groovy-jdk/java/util/Collection.html#sort(groovy.lang.Closure closure)
Also it would help if the documentation includes the fact that the closure can take either one or two parameters (and the expected behavior in both cases).
Thanks.