Propagating annotations into type arguments
This commit is contained in:
committed by
Denis Zharkov
parent
4248654f5f
commit
9644eeb047
@@ -105,3 +105,5 @@ public fun <T> Collection<T>.toReadOnlyList(): List<T> =
|
||||
if (isEmpty()) Collections.emptyList() else ArrayList(this)
|
||||
|
||||
public fun <T: Any> T?.singletonOrEmptyList(): List<T> = if (this != null) Collections.singletonList(this) else Collections.emptyList()
|
||||
|
||||
public inline fun <T> List<T>.getOrDefault(index: Int, default: (Int) -> T): T = if (index in 0..size() - 1) this[index] else default(index)
|
||||
Reference in New Issue
Block a user