All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.cqfn.diktat.ruleset.utils.SequenceUtils.kt Maven / Gradle / Ivy

There is a newer version: 1.2.5
Show newest version
/**
 * Utility methods to work with sequences
 */

package org.cqfn.diktat.ruleset.utils

/**
 * @param pred a predicate
 * @return filtered sequence
 */
fun  Sequence.takeWhileInclusive(pred: (T) -> Boolean): Sequence {
    var shouldContinue = true
    return takeWhile {
        val result = shouldContinue
        shouldContinue = pred(it)
        result
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy