[SortRecordList] remove duplicates

[SortRecordList] remove duplicates

  
Forge Component
(14)
Published on 2015-11-19 by Pedro Cardoso
14 votes
Published on 2015-11-19 by Pedro Cardoso
Could you add an input to the list sort so that it will remove duplicates?
Hi Jason,

There is an action in the extension just for that (the DistinctRecordList action).
Just call it first and then the Sort.

Regards,
João Rosado
Thank you!
João,

Wouldn't sorting first theoretically speed up searching for distinct records? Or does the action rely on blackbox magic from .NET/Java to remove the distinct records?
Hi Kilian,

It's "blackbox" in .NET, it uses the Enumerable.Distinct and the documentation explicitly says that it returns an unordered sequence.

The Java version uses internal undocumented/unsupported platform methods. That actually "currenctly" respects (but does not guarantee) the original order and does not take any advantage on the list being ordered or not.

So doing the Distinct first is safer and has no impact on performance.

Regards,
João Rosado
Ok, thanks!