0 votes
1 view
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 (31.8k 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.
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...