I create objects from the class called Company
. How can I get the very first created object?
Asked
Active
Viewed 629 times
-4

Andrew Lygin
- 6,077
- 1
- 32
- 37

user6731260
- 105
- 1
- 1
- 4
-
6possible duplicate of http://stackoverflow.com/questions/4839834/get-the-first-element-of-a-list-idiomatically-in-groovy – ABC Aug 24 '16 at 10:35
1 Answers
0
If Company
is a persistent object (an instance of a domain class), this should work
def firstCompany = Company.first()

Dónal
- 185,044
- 174
- 569
- 824