partitionDedupByKey<K extends Comparable<K>> method

(Slice<T>, Slice<T>) partitionDedupByKey<K extends Comparable<K>>(
  1. K key(
    1. T
    )
)

Moves all but the first of consecutive elements to the end of the list that resolve to the same key. Returns two slices. The first contains no consecutive repeated elements. The second contains all the duplicates in no specified order. If the list is sorted, the first returned list contains no duplicates.

Implementation

@pragma("vm:prefer-inline")
(Slice<T> dedup, Slice<T> duplicates)
    partitionDedupByKey<K extends Comparable<K>>(K Function(T) key) {
  return partitionDedupBy((e0, e1) => key(e0) == key(e1));
}