https://kotlinlang.org logo
Title
r

raulraja

09/03/2017, 10:44 PM
@pablisco if you want to perform effects up until a given condition you can try
takeWhile
which stops when the predicate is no longer valid, then with the resulting list you can call
forEach
p

pablisco

09/03/2017, 10:51 PM
I wrote it like this:
private fun typeEquals(from: ParameterizedType, to: ParameterizedType, typeVarMap: Map<String, Type>): Boolean =
    if (from.rawType == to.rawType) {
        from.actualTypeArguments
            .zip(to.actualTypeArguments)
            .all { (from, to) -> matches(from, to, typeVarMap) }
    } else {
        false
    }
Should work right?