History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GROOVY-1007
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Paul King
Reporter: Antti Karanta
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
groovy

List#indexOf(groovy.lang.Closure closure) and friends to groovy jdk

Created: 15/Aug/05 04:51 AM   Updated: 23/Dec/07 12:25 PM
Component/s: groovy-jdk
Affects Version/s: None
Fix Version/s: 1.5.2

Time Tracking:
Not Specified


 Description  « Hide
find(groovy.lang.Closure closure) and findAll(groovy.lang.Closure closure) methods are really useful. It would be also good to have

List#indexOf(groovy.lang.Closure closure)
List#indexOf(int startIndex, groovy.lang.Closure closure) // startIndex tells from which index to start looking
int[] List#indicesOfAll(groovy.lang.Closure closure) // return type may also be a List<Integer> or whatever
List#lastIndexOf(groovy.lang.Closure closure)

in the groovy jdk as it is sometimes important to know where the elements fullfilling the given condition are in the list.



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Paul King - 22/Dec/07 09:00 PM
There was already a findIndexOf() method so I added findLastIndexOf() and findIndexValues(). All three variations take an optional start index.