Created
May 12, 2019 22:05
-
-
Save matteo-grella/f7fd414db1947e7204f5bf06fe8958c0 to your computer and use it in GitHub Desktop.
Return the list if it is not empty, otherwise null
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return the list if it is not empty, otherwise null | |
*/ | |
private fun <T>List<T>.notEmptyOrNull(): List<T>? = if (this.isEmpty()) null else this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment