Fix Android compatibility
parent
6b95a8c55e
commit
0366ad0e57
@ -0,0 +1,18 @@
|
||||
package org.koitharu.kotatsu.parsers.util.json
|
||||
|
||||
import org.json.JSONArray
|
||||
|
||||
class JSONTypedIterator<T>(
|
||||
private val array: JSONArray,
|
||||
private val cls: Class<T>,
|
||||
) : Iterator<T> {
|
||||
|
||||
private val total = array.length()
|
||||
private var index = 0
|
||||
|
||||
override fun hasNext() = index < total
|
||||
|
||||
override fun next(): T {
|
||||
return cls.cast(array.get(index++))
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue