2019-12-22 14:06:03 +01:00
|
|
|
package jp.juggler.util
|
|
|
|
|
|
|
|
// same as x?.let{ dst.add(it) }
|
|
|
|
fun <T> T.addTo(dst: ArrayList<T>) = dst.add(this)
|
2020-01-07 09:03:32 +01:00
|
|
|
|
2020-12-07 13:23:14 +01:00
|
|
|
fun <E : List<*>> E?.notEmpty(): E? =
|
|
|
|
if (this?.isNotEmpty() == true) this else null
|
|
|
|
|
|
|
|
fun <E : Map<*, *>> E?.notEmpty(): E? =
|
|
|
|
if (this?.isNotEmpty() == true) this else null
|
2021-05-11 08:12:43 +02:00
|
|
|
|
|
|
|
fun ByteArray?.notEmpty(): ByteArray? =
|
|
|
|
if (this?.isNotEmpty() == true) this else null
|