Skip to content

Commit a4fffe9

Browse files
Fix some errors from previous commit
1 parent 6c0ddff commit a4fffe9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/main/kotlin/KotlinFunctionLibrary.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ println("workingList2=$workingList2")*/
10181018
list.recursiveFind({ it.a == 'a' }) { it.b } != null == true
10191019
list.recursiveFind({ it.a == 'f' }) { it.b } != null == true
10201020
* */
1021-
inline fun <E> List<E>.recursiveFind(predicate: (E) -> Boolean, recursiveSelector: (E) -> List<E>): E? {
1021+
fun <E> List<E>.recursiveFind(predicate: (E) -> Boolean, recursiveSelector: (E) -> List<E>): E? {
10221022
if (isEmpty()) return null
10231023
for (element in this) {
10241024
return if (predicate(element)) element else /*check the next layer*/ recursiveSelector(element).recursiveFind(
@@ -1028,7 +1028,7 @@ println("workingList2=$workingList2")*/
10281028
}
10291029
return null
10301030
}
1031-
inline fun <E> List<E>.recursiveForEach(action: (E) -> Unit, recursiveSelector: (E) -> List<E>): Unit {
1031+
fun <E> List<E>.recursiveForEach(action: (E) -> Unit, recursiveSelector: (E) -> List<E>): Unit {
10321032
if (isEmpty()) return
10331033
for (element in this) {
10341034
action(element)
@@ -1052,7 +1052,7 @@ println(x in z) //prints true
10521052

10531053
inline fun <T> List<T>.contains(other: List<T>, predicate: (thisElement: T, otherElement: T) -> Boolean): Boolean = indexOf(other, 0, this.size, predicate) >= 0
10541054

1055-
private inline fun <T> List<T>.indexOf(other: List<T>, startIndex: Int, endIndex: Int, predicate: (thisElement: T, otherElement: T) -> Boolean): Int {
1055+
inline fun <T> List<T>.indexOf(other: List<T>, startIndex: Int, endIndex: Int, predicate: (thisElement: T, otherElement: T) -> Boolean): Int {
10561056
fun <T> List<T>.regionMatches(thisOffset: Int, other: List<T>, otherOffset: Int, size: Int, predicate: (thisElement: T, otherElement: T) -> Boolean): Boolean {
10571057
if ((otherOffset < 0) || (thisOffset < 0) || (thisOffset > this.size - size) || (otherOffset > other.size - size)) {
10581058
return false
@@ -1074,14 +1074,14 @@ println(x in z) //prints true
10741074
}
10751075

10761076

1077-
private fun <T> Iterable<T>.collectionSizeOrDefault(default: Int): Int = if (this is Collection<*>) this.size else default
1077+
fun <T> Iterable<T>.collectionSizeOrDefault(default: Int): Int = if (this is Collection<*>) this.size else default
10781078

1079-
inline fun <E, R> Iterable<E>.recursiveMap(
1079+
fun <E, R> Iterable<E>.recursiveMap(
10801080
transform: (E) -> R,
10811081
recursiveSelector: (E) -> Iterable<E>
10821082
): List<R> = recursiveMapTo(ArrayList(collectionSizeOrDefault(10)), transform, recursiveSelector)
10831083

1084-
inline fun <T, R, C: MutableCollection<in R>> Iterable<T>.recursiveMapTo(
1084+
fun <T, R, C: MutableCollection<in R>> Iterable<T>.recursiveMapTo(
10851085
destination: C,
10861086
transform: (T) -> R,
10871087
recursiveSelector: (T) -> Iterable<T>

0 commit comments

Comments
 (0)