Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
android-components
Commits
742786c2
Commit
742786c2
authored
Mar 08, 2019
by
Michael Comella
Committed by
Sebastian Kaspari
Mar 12, 2019
Browse files
Closes #651 - post: Remove inline of mapNotNull to fix jacoco.
parent
312222e8
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/support/ktx/src/main/java/mozilla/components/support/ktx/android/org/json/JSONArray.kt
View file @
742786c2
...
...
@@ -39,6 +39,7 @@ fun <T> JSONArray?.toList(): List<T> {
return
listOf
()
}
// #2305: inline this function when Android gradle plugin v3.4.0 is released
/**
* Returns a list containing only the non-null results of applying the given [transform] function
* to each element in the original collection as returned by [getFromArray]. If [getFromArray]
...
...
@@ -49,7 +50,7 @@ fun <T> JSONArray?.toList(): List<T> {
* jsonArray.mapNotNull(JSONArray::getJSONObject) { jsonObj -> jsonObj.getString("author") }
* ```
*/
inline
fun
<
T
,
R
:
Any
>
JSONArray
.
mapNotNull
(
getFromArray
:
JSONArray
.(
index
:
Int
)
->
T
,
transform
:
(
T
)
->
R
?):
List
<
R
>
{
fun
<
T
,
R
:
Any
>
JSONArray
.
mapNotNull
(
getFromArray
:
JSONArray
.(
index
:
Int
)
->
T
,
transform
:
(
T
)
->
R
?):
List
<
R
>
{
val
transformedResults
=
mutableListOf
<
R
>()
for
(
i
in
0
until
this
.
length
())
{
try
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment