dave08
12/11/2022, 11:45 AM/**
* Builds a query that returns the single element.
* When the query is executed, it throws [NoSuchElementException] for empty query result and [IllegalStateException]
* for query result that contains more than one element.
*
* @param T the element type of [List]
* @return the query
*/
fun <T> ListQuery<T>.single(): Query<T> = collect { it.single() }
It's an java.lang.IllegalArgumentException: Flow has more than one element
not IllegalStateException