to Properties
Начиная с Kotlin: 1.0
inline fun Map<String, String>.toProperties(): Properties
Преобразует эту Map в объект Properties.
Примеры
import kotlin.test.*
import java.util.*
fun main() {
//sampleStart
val map = mapOf("x" to "value A", "y" to "value B")
val props = map.toProperties()
println(props.getProperty("x")) // value A
println(props.getProperty("y", "fail")) // value B
println(props.getProperty("z", "fail")) // fail
//sampleEnd
}
© 2010–2026 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/to-properties.html