[Commonizer] Rename type parameter from 'Context' to 'T'
NullableContextualSingleInvocationCommonizer: Naming the type parameter 'Context' might provoke different/ misleading intuitions for many. https://jetbrains.team/im/code/KFc0x1LxezP?message=BDpl60SJkVM&channel=2Ty4Ld4L0Aer ^KT-48567
This commit is contained in:
committed by
Space
parent
2e053be703
commit
f3e55aeac0
+4
-4
@@ -9,14 +9,14 @@ interface NullableContextualSingleInvocationCommonizer<T : Any, R : Any> {
|
||||
operator fun invoke(values: List<T>): R?
|
||||
}
|
||||
|
||||
fun <Context : Any, R : Any> NullableContextualSingleInvocationCommonizer<Context, R>.asCommonizer(): Commonizer<Context, R?> =
|
||||
object : Commonizer<Context, R?> {
|
||||
private val collectedValues = mutableListOf<Context>()
|
||||
fun <T : Any, R : Any> NullableContextualSingleInvocationCommonizer<T, R>.asCommonizer(): Commonizer<T, R?> =
|
||||
object : Commonizer<T, R?> {
|
||||
private val collectedValues = mutableListOf<T>()
|
||||
|
||||
override val result: R?
|
||||
get() = this@asCommonizer.invoke(collectedValues)
|
||||
|
||||
override fun commonizeWith(next: Context): Boolean {
|
||||
override fun commonizeWith(next: T): Boolean {
|
||||
collectedValues.add(next)
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user