CollectionOps

scala.build.CollectionOps
object CollectionOps

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Extensions

Extensions

extension [T](items: Seq[T])
def distinctBy[K](f: T => K): Seq[T]

Works the same standard lib's distinct, but only differentiates based on the key extracted by the passed function. If more than one value exists for the same key, only the first one is kept, the rest is filtered out.

Works the same standard lib's distinct, but only differentiates based on the key extracted by the passed function. If more than one value exists for the same key, only the first one is kept, the rest is filtered out.

Type parameters

K

type of the key used for distinction

Value parameters

f

function to extract the key used for distinction

Attributes

Returns

the sequence of items with distinct items.map(f)