I know that Salesforce does not support lambda expressions and query syntax (like in LINQ) queries in apex collections. But, It would be a nice feature for developers.
Has anyone tried implementing similar kind of thing in Apex ? I found this github link where someone tried this, but its too big a package to include in the project.
For example
List<Opportunity> opportunities = new List<Opportunity>();
opportunities = [SELECT Id, Amount, StageName from Opportunity LIMIT 49000];
List<Opportunity> hugeOpportunities = opportunities.Where(o => o.Amount > 40000);
List<Opportunity> opportunities = new List<Opportunity>();
opportunities = [SELECT Id, Amount, StageName from Opportunity LIMIT 49000];
List<Opportunity> hugeOpportunities = from o in opportunities
where o.Amount > 40000
select o;
Also, I can see an idea here, but somehow it has not yet received the votes needed to get picked by Salesforce.
Does Salesforce have any plans to implement this in future. Features that would be very useful as a developer would be to have support for
- Anonymous classes
- Lambda expressions (similar to method syntax of LINQ in C#)
- Query syntax (similar to query syntax of LINQ in C#)
Can someone please suggest me an alternative for this, using which I can query on the collections without having to worry about the CPU time limit?