# CountDownFuture

Artifact: [androidx.media3:media3-test-utils](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/test/utils/CountDownFuture.java+class:androidx.media3.test.utils.CountDownFuture)

*** ** * ** ***


```
@UnstableApi
class CountDownFuture : AbstractFuture<Void!>
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | com.google.common.util.concurrent.internal.InternalFutureFailureAccess |||
|   | ↳ | [com.google.common.util.concurrent.AbstractFuture](https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html)\<[Void](https://developer.android.com/reference/java/lang/Void.html)!\> ||
|   |   | ↳ | [androidx.media3.test.utils.CountDownFuture](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CountDownFuture) |

*** ** * ** ***

A `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that completes when `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CountDownFuture#countDown()` has been called a specified number of times.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CountDownFuture#CountDownFuture(int)(count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Creates an instance initialized with the specified count. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CountDownFuture#countDown()()` Decrements the remaining count, completing the future when it reaches 0. |

### Inherited functions

From [com.google.common.util.concurrent.AbstractFuture](https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#addListener(java.lang.Runnable, java.util.concurrent.Executor)(listener: https://developer.android.com/reference/java/lang/Runnable.html!, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#afterDone()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#cancel(boolean)(mayInterruptIfRunning: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` `V!` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#get(long, java.util.concurrent.TimeUnit)(timeout: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, unit: https://developer.android.com/reference/java/util/concurrent/TimeUnit.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#interruptTask()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#isCancelled()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#isDone()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#pendingToString()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#set(V)(value: V!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#setException(java.lang.Throwable)(throwable: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#setFuture(com.google.common.util.concurrent.ListenableFuture&lt;? extends V&gt;)(future: https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<V!>!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#toString()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html?` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#tryInternalFastPathGetFailure()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/AbstractFuture.html#wasInterrupted()()` From [java.util.concurrent.Future](https://developer.android.com/reference/java/util/concurrent/Future.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html!` `https://developer.android.com/reference/java/util/concurrent/Future.html#exceptionNow()()` `V!` `https://developer.android.com/reference/java/util/concurrent/Future.html#resultNow()()` `https://developer.android.com/reference/java/util/concurrent/Future.State.html!` `https://developer.android.com/reference/java/util/concurrent/Future.html#state()()`

## Public constructors

### CountDownFuture

```
CountDownFuture(count: Int)
```

Creates an instance initialized with the specified count.

| Parameters |
|---|---|
| `count: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The number of times `https://developer.android.com/reference/kotlin/androidx/media3/test/utils/CountDownFuture#countDown()` must be invoked before completing. If 0, the future completes immediately. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if count is negative. |

## Public functions

### countDown

```
fun countDown(): Unit
```

Decrements the remaining count, completing the future when it reaches 0.