public static int findLastIndexOf ( Object self , int startIndex , Closure closure ) { int result = - 1 ; int i = 0 ; BooleanClosureWrapper bcw = new BooleanClosureWrapper ( closure ) ; for ( Iterator iter = InvokerHelper . asIterator ( self ) ; iter . hasNext ( ) ; i ++ ) { Object value = iter . next ( ) ; if ( i < startIndex ) { continue ; } if ( bcw . call ( value ) ) { result = i ; } } return result ; }
Iterates over the elements of an iterable collection of items starting from a specified startIndex and returns the index of the last item that matches the condition specified in the closure .