Skip to content

Commit

Permalink
rename function and use
Browse files Browse the repository at this point in the history
The function in this class was not used but we can rename it and use it as it uses the removeAt function which we need due to the collision with the stdlib.
  • Loading branch information
mikescamell committed Oct 25, 2024
1 parent 2d04724 commit 2b3b91c
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private class ViewChildrenRecursiveSequence(private val view: View) : Sequence<V

private class RecursiveViewIterator(view: View) : Iterator<View> {
private val sequences = arrayListOf(view.childrenSequence())
private var current = sequences.removeLast().iterator()
private var current = sequences.removeLastElement().iterator()

override fun next(): View {
if (!hasNext()) throw NoSuchElementException()
Expand All @@ -80,13 +80,13 @@ private class ViewChildrenRecursiveSequence(private val view: View) : Sequence<V

override fun hasNext(): Boolean {
if (!current.hasNext() && sequences.isNotEmpty()) {
current = sequences.removeLast().iterator()
current = sequences.removeLastElement().iterator()
}
return current.hasNext()
}

@Suppress("NOTHING_TO_INLINE")
private inline fun <T : Any> MutableList<T>.removeLast(): T {
private inline fun <T : Any> MutableList<T>.removeLastElement(): T {
if (isEmpty()) throw NoSuchElementException()
return removeAt(size - 1)
}
Expand Down

0 comments on commit 2b3b91c

Please sign in to comment.