Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
With regards to a thread in the groovy user list here:
A take( n ) method would be a really useful addition to the Groovy codebase
It is assumed it will work similar to other languages, in that:
def a = [ 1, 2, 3 ] assert a.take( 0 ) == [] assert a.take( 1 ) == [ 1 ] assert a.take( 4 ) == [ 1, 2, 3 ]
The method should work for Collection, String, Map and lazily for Iterator, Reader and InputStream
Attachments
Attachments
Issue Links
- relates to
-
GROOVY-5414 Groovy could benefit from DGM takeWhile and dropWhile methods
- Closed