tracker issue : CF-4201365

select a category, or use search below
(searches all categories and all time range)
Title:

new function for finding the first element using a closure or enhance find()

| View in Tracker

Status/Resolution/Reason: To Fix//HaveNewInfo

Reporter/Name(from Bugbase): Luis Majano / Luis Majano ()

Created: 02/28/2018

Components: Language

Versions: 2016

Failure Type: Others

Found In Build/Fixed In Build: /

Priority/Frequency: Normal /

Locale/System: /

Vote Count: 0

Right now the only way to short circuit and return an element in a collection is doing an imperative for loop and breaking, or using a combination of find() with get().  If we want functional programming to take the fore-front we are still missing several features.  Having a way to filter a collection for only 1 element with a break is non-existent.

I propose either a new function called **first( closure )** that can give me the first element that passes the closure syntax or enhacning the **find( closure, [ index or value] )** function which basically returns the index location of the element in the array, but what we want sometimes is the value.

Attachments:

Comments: