mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-04 23:28:19 -05:00
Use first {} over filter {}
This commit is contained in:
parent
fba4e04fdb
commit
799d8e2637
@ -77,12 +77,16 @@ class BookAdapter(val b: Book, val lookup: VerseLookup)
|
||||
lM: RecyclerView.LayoutManager) {
|
||||
provider subscribe {
|
||||
val event = it
|
||||
chapterList.withIndices()
|
||||
.filter {
|
||||
event.b == it.second.bibleBook &&
|
||||
event.chapter == it.second.chapter
|
||||
}
|
||||
.forEach { lM scrollToPosition it.first }
|
||||
lM scrollToPosition
|
||||
// Get all objects in the form (index, object)
|
||||
chapterList.withIndices()
|
||||
// Get one that matches our book and chapter
|
||||
.first {
|
||||
event.b == it.second.bibleBook &&
|
||||
event.chapter == it.second.chapter
|
||||
}
|
||||
// And get that index value to scroll to
|
||||
.first
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user