Apex Lambda Versions Save

Functional programming for Salesforce Apex

10.0.0

8 months ago
  • null values now compared in PrimitiveComparer. Where relevant, null is smaller than non null.
  • OptionalDouble and OptionalDecimal values are final.
  • DoubleCollection, DecimalCollection and ObjectCollection constructors take Iterable instead of List. Constructors are private and collections are build with of to match SObjectCollection.
  • Directory structure was simplified to match an empty sf (sfdx) template.
  • Github action has been updated to work.

9.1.0

2 years ago
  • Adds min and max to DoubleCollection and DecimalCollection
  • Renames AssignTo to Modify
  • Simplifies Fn structure

8.1.0

2 years ago
  • Adds support for mapping to objects on Fn.MapTo
  • Introduces ObjectCollection to serve as a target for object mappings

7.0.0

2 years ago
  • Lazy evaluation was added through SObjectStream
  • Library name has changed to apex-fp, to avoid confusion with apex/up for AWS Lambda
  • Documentation improvements and clean-ups

8.0.0

2 years ago
  • Introduces MapTo
  • Raises test coverage
  • Consolidates many function factories into Fp

6.0.0

2 years ago

Project moved to SFDX

5.0.0

5 years ago

Transform and resulting RecordTransform functionality were moved to explicitly named CopyFields to make the purpose clearer.

4.0.0

5 years ago

Experimental reduceType methods were removed in favour of mapToType style of methods, which return TypeCollection. This is similar to Java's Stream. For example,

Decimal totalAmount = Collection.of(opps).mapToDecimal(Opportunity.Amount).sum();

Current API is also unstable, and will possibly change to make the naming more consistent or to remove redundancies.

Previous naming favoured plural endings (groupByStrings, pluckDoubles), while new type collections use Java's singular convention.

One example of redundancy is Collection.of(opps).pluckDecimals(Opportunity.Amount) which yields the same result as Collection.of(opps).mapToDecimal(Opportunity.Amount).asList().

3.1.0

5 years ago

Adds Transform to support prototype-matching definition of SObjectToSobject functions. Put simply,

Opportunity prototype = new Opportunity(Name = 'Test')
Collection.of(opps).mapAll(Transform.record(prototype));

will copy all defined field values on the provided prototype to records in collection, overwriting any existing values for those fields. Other fields will not be touched.

3.0.0

5 years ago

Implements the general programme described in #4. Collection class has been introduced as a view of underlying Apex collections which provides functional methods.

For simpler cases, the change brings more verbosity, for example:

Pluck.strings(Account.Name, accounts);
Collection.of(accounts).pluckStrings(Account.Name);

However, for more complex cases, the readability is improved, and the library is more flexible. Compare previously required nesting with chaining:

Pluck.strings(..., MapAll.records(..., Filter.field(...)));
Collection.of(accounts).filter(...).mapAll(...).pluckStrings(...);

The number of classes was reduced, and behaviour generally harmonized across different functionalities. Since the API was completely changed, a migration is required, which should be straightforward in most cases.