Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.7-rc-1, 1.6.7
-
None
Description
As per mailing list, Groovy should have a subsequences method.
Once implemented, the following assertions should pass:
def items = [1, 2, 3] assert items.subsequences() == [[1, 2, 3], [1, 3], [2, 3], [1, 2], [1], [2], [3]] as Set assert "frog".toList().subsequences() == [ ['f', 'r', 'o', 'g'], ['f', 'r', 'o'], ['f', 'r', 'g'], ['f', 'o', 'g'], ['r', 'o', 'g'], ['f', 'g'], ['r', 'g'], ['o', 'g'], ['f', 'o'], ['r', 'o'], ['f', 'r'], ['f'], ['r'], ['o'], ['g'] ] as Set