Consumer

fun interface Consumer<T>

port of java.util.function.Consumer

Represents an operation that accepts a single input argument and returns no result. Unlike most other functional interfaces, Consumer is expected to operate via side-effects.

This is a package-summary.html whose functional method is .accept.

Since

1.8

Parameters

the type of the input to the operation

Functions

Link copied to clipboard
abstract fun accept(t: T)

Performs this operation on the given argument.

Link copied to clipboard
open fun andThen(after: Consumer<in T>): Consumer<T>

Returns a composed Consumer that performs, in sequence, this operation followed by the after operation. If performing either operation throws an exception, it is relayed to the caller of the composed operation. If performing this operation throws an exception, the after operation will not be performed.