forked from upstream-mirrors/quik
added .forEach() extension to cursor
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package com.moez.QKSMS.util
|
||||
|
||||
import android.database.Cursor
|
||||
|
||||
fun Cursor.forEach(closeOnComplete: Boolean = true, method: (Cursor) -> Unit = {}) {
|
||||
moveToPosition(-1)
|
||||
while (moveToNext()) {
|
||||
method.invoke(this)
|
||||
}
|
||||
|
||||
if (closeOnComplete) {
|
||||
close()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user