In groovy how to find the last iteration inside the closure.
def closure = { it->
//here I need to print last line only
}
new File (file).eachLine{ closure(it)}
Need to find inside the closure
iteration.
Update 1:
Instead of reading a file, In Common How can i find the last iteration inside the closure ?
def closure = { it->
//Find last iteration here
}