sdk-common / com.tomtom.online.sdk.common.functional.collections / Sets

Sets

class Sets

A collection of predefined general-purpose methods for working with java.util.Set.

Constructors

<init>

Sets()

A collection of predefined general-purpose methods for working with java.util.Set.

Functions

map

static fun <A : Any!, B : Any!> map(set: MutableSet<A>, mapper: (A) -> B): MutableSet<B>

Returns a set consisting of the results of applying the specified mapper to the elements of the given set. As the method is working directly with Set it needs to create one, thus it returns a HashSet as a Set. Sets#map(Set, Supplier, Function1) method instead.

static fun <A : Any!, B : Any!, C : MutableCollection<B>!> map(set: MutableSet<A>, supplier: Supplier<out C>, mapper: (A) -> B): C

Returns a set consisting of the results of applying the specified mapper to the elements of the given set. It's possible to specify what underlying Set implementation should be returned as a result.