public static < T > List < Number > findIndexValues ( Iterator < T > self , Number startIndex , @ ClosureParams ( FirstParam . FirstGenericType . class ) Closure condition ) { List < Number > result = new ArrayList < Number > ( ) ; long count = 0 ; long startCount = startIndex . longValue ( ) ; BooleanClosureWrapper bcw = new BooleanClosureWrapper ( condition ) ; while ( self . hasNext ( ) ) { Object value = self . next ( ) ; if ( count ++ < startCount ) { continue ; } if ( bcw . call ( value ) ) { result . add ( count - 1 ) ; } } return result ; }
Iterates over the elements of an Iterator starting from a specified startIndex and returns the index values of the items that match the condition specified in the closure .