package app.furmeet.events.system.helper

import org.json.JSONArray

fun JSONArray.size() = length()

@Suppress("UNCHECKED_CAST")
fun <T> JSONArray.iterator(): Iterator<T> =
        (0 until length()).asIterable().map { get(it) as T }.iterator()

fun <T> JSONArray.asSequence(): Sequence<T> = iterator<T>().asSequence()

fun <T> JSONArray.toList(): List<T> = asSequence<T>().toList()


