flatMapToSet

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

Transforms each element of the receiver iterable to an iterable and flattens these iterables into a single set.

Receiver

The iterable to be transformed.

Return

A set containing the flattened transformed elements from the receiver iterable.

Parameters

destination

The destination set where the transformed elements are placed. By default, it is an empty mutable set.

transform

A function that maps elements of the receiver iterable to an iterable of output elements.


inline fun <T, R> Sequence<T>.flatMapToSet(destination: MutableSet<R> = mutableSetOf(), transform: (T) -> Iterable<R>): Set<R>(source)

Transforms each element of the receiver iterable to an iterable and flattens these iterables into a single set.

Receiver

The sequence to be transformed.

Return

A set containing the flattened transformed elements from the receiver iterable.

Parameters

destination

The destination set where the transformed elements are placed. By default, it is an empty mutable set.

transform

A function that maps elements of the receiver iterable to an iterable of output elements.