filterWithNextEnclosing

inline fun <T> Iterable<T>.filterWithNextEnclosing(crossinline predicate: (a: T, b: T) -> Boolean): List<T>

Returns a list containing only elements where the pair of it and its successor (including the enclosing pair) matches the given predicate.