Groovy: Get First n Elements from a List Jaseem V V A Groovy snippet to get first n elements from a list. def a = [1, 2, 3, 4, 5, 6, 7, 8, 9] a.take(3) // [1, 2, 3] Written: Friday, 04 October 2013 Categories: groovy Tags: #groovy Next: Groovy's JsonBuilder Nuances Previous: Getting Started With GroovyFX