Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Salesforce by (11.9k points)

Does Apex support the concept of lambdas?

Ultimately, I am trying to DRY up some really repetitive code in my tests, so I'd love to be able to pass functions around, something like this (C#-esq).

public static TestMethod void some_test_method(){

  Arrange( ()=>

    // some setup stuff

  );

  Act( ()=>

    // test action

  );

  System.assertEquals(...);

}

1 Answer

0 votes
by (32.1k points)
Apex doesn't have lambdas, it also doesn't have anonymous classes. You'll have to compulsorily stick to declared classes. Apex doesn't support Java interfaces and abstract classes.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
+1 vote
1 answer

Browse Categories

...