Reputation: 57
I want to return the values of file in the return statement using groovy ?
ex: file has three lines abc,abd,abe then i should get output as return['abc','abd','abe']
Upvotes: 0
Views: 700
Reputation: 187529
It sounds like you want to read the file contents into a list of Strings, with one list item for each line. The following will accomplish that:
List<String> fileContents = new File('/path/to/file.txt').readLines()
Upvotes: 3