arrow-fx-coroutines / arrow.fx.coroutines / ConcurrentVar / isEmpty

isEmpty

abstract suspend fun isEmpty(): Boolean

Returns true if there are no elements. Otherwise false. This may be outdated immediately; use tryPut or tryTake to put & take without suspending.

import arrow.fx.coroutines.*

suspend fun main(): Unit {
  //sampleStart
  val empty = ConcurrentVar.empty<Int>().isEmpty()
  val full = ConcurrentVar(10).isEmpty()
  //sampleEnd
  println("empty: $empty, full: $full")
}

Do you like Arrow?

Arrow Org
<