io.justdevit.kotlin.boost.extension.Set.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of boost-commons Show documentation
Show all versions of boost-commons Show documentation
Library to boost working with Kotlin/JVM projects.
The newest version!
package io.justdevit.kotlin.boost.extension
/**
* Maps the elements of the set to a new set based on the provided mapper function.
*
* @param mapper The function used to map each element of the set.
* @return The resulting set after applying the mapper function to each element of the set,
* or an empty set if the input set is null.
* @param T The type of the elements in the input set.
* @param U The type of the elements in the resulting set.
*/
fun Set?.mapOrEmpty(mapper: (T) -> U): Set = this?.map { mapper(it) }?.toSet() ?: emptySet()
© 2015 - 2025 Weber Informatics LLC | Privacy Policy