Link Search Menu Expand Document

Using extract<T?> is the better way than Config.hasPath(). extract<T?> returns T when the path exists and null when it does not exist.

val config = ConfigFactory.parseString("""key = 10""")
val key = config.extract<Int?>("key")
val foo = config.extract<Int?>("foo")
println(key) // 10
println(foo) // null

Copyright © 2016-2021 morihiro, since 2021 The Config4k Team. Distributed by an Apache License 2.0.