Skip to content

//shared/org.readium.r2.shared.extensions/mapNotNull

mapNotNull

[androidJvm]\ fun <T> JSONObject.mapNotNull(transform: (Pair<String, Any>) -> T?): List<T>

Returns a list containing the results of applying the given transform function to each element in the original JSONObject. If the tranform returns null, it is not included in the output list.

[androidJvm]\ fun <T> JSONArray.mapNotNull(transform: (Any) -> T?): List<T>

Returns a list containing the results of applying the given transform function to each element in the original JSONArray. If the tranform returns null, it is not included in the output list.