mapToSet

inline fun <T, R> Iterable<T>.mapToSet(destination: MutableSet<R> = mutableSetOf(), transform: (T) -> R): MutableSet<R>

Transform the receiver via the supplied function and collect the results into an optionally provided set. Answer the result set.

Return

The resultant MutableSet.

Parameters

T

The element type of the incoming Iterable.

R

The element type of the outgoing Set.

destination

The destination MutableSet. Defaults to mutableSetOf.

transform

The function to map keys to values.