# Consumer

# Consumer

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/util/Consumer.kt+class:androidx.core.util.Consumer)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/util/Consumer "View this page in Java")

<br />

```
fun interface Consumer<T : Any?>
```

<br />

Known direct subclasses  
[TestConsumer](https://developer.android.com/reference/kotlin/androidx/core/testing/util/TestConsumer)  

|--------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TestConsumer](https://developer.android.com/reference/kotlin/androidx/core/testing/util/TestConsumer) | An implementation of[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)to capture values during a test and allows developers to perform assertions on the values. |

*** ** * ** ***

Compat version of[java.util.function.Consumer](https://developer.android.com/reference/java/util/function/Consumer.html)  

|                                       Parameters                                       |
|----------------------------------------------------------------------------------------|----------------------------------------|
| `<T : `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?>` | the type of the input to the operation |

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [accept](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer#accept(kotlin.Any))`(value: T)` Performs this operation on the given argument. |

## Public functions

### accept

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
fun accept(value: T): Unit
```

Performs this operation on the given argument.  

| Parameters |
|------------|--------------------|
| `value: T` | the input argument |