JADE Environment Development Ideas

What's new in the upcoming JADE release?

IMPROVED DEVELOPER EFFICIENCY. ENHANCED SECURITY. SMOOTHER INTEGRATION

The JADE 2022 release meets tomorrow’s business demands.


Start your update to JADE's latest release

A Collection::copy which skips objects already in target collection

It would be useful for there to be a version of Collection::copy(targetCollection) which automatically ignores objects which are already in the target collection.

Having this as a fast collection copy would be more efficient than the current approach where one needs to foreach the source collection and then do a selective add. This selective add could be either via "if not includes" style logic, for historical code, via a suitable exception handler, if a low number of collisions are expected, or via the new "tryAdd" methods for systems already running on JADE 2020.

  • BeeJay
  • Aug 17 2021
  • Shipped
  • Attach files
  • Kevin Saul commented
    August 23, 2021 02:37

    Following problems we had with our own version of such a method on Collection - we created a copyFrom method which reversed how the copy worked so we'd copy from the source collection supplied, the advantage being we could iterate that collection using an iterator or discreteLock, rather than the collection being implicitly share locked while the entire collection is copied.

    In addition to a 'tryCopy' method BeeJay has suggested above - could we get a 'tryCopyFrom' method which works in reverse with the rationale above of avoiding a long-held share lock.

    Would deferred equivalents like tryAddDeferred apply in this context as well?