Created
May 25, 2014 13:15
-
-
Save back2dos/7e0fd1e77c2fd69a2661 to your computer and use it in GitHub Desktop.
Custom indexOf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package ; | |
| class Helper { | |
| static public function indexOf<A>(i:Iterable<A>, filter:A->Bool):Int { | |
| var i = 0; | |
| for (x in a) { | |
| i++; | |
| if (filter(x)) return i; | |
| } | |
| return -1; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment