distinct
For any type T,
distinct(collection: List<T>) : List<T>
distinct(collection: Bag<T>) : Bag<T>
Returns the unique items in collection.
- For lists,
distinctdeduplicates the collection while preserving the order of the items in the original list: The first occurance of an element is kept and all other subsequent occurances are dropped.list = [1, 2, 3, 1, 4, 2];
uniqueList = distinct(list); // [1, 2, 3, 4]