All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.fleeksoft.ksoup.ported.Consumer.kt Maven / Gradle / Ivy

Go to download

Ksoup is a Kotlin Multiplatform library for working with HTML and XML, and offers an easy-to-use API for URL fetching, data parsing, extraction, and manipulation using DOM and CSS selectors.

The newest version!
package com.fleeksoft.ksoup.ported

public fun interface Consumer {
    /**
     * Performs this operation on the given argument.
     *
     * @param t the input argument
     */
    public fun accept(t: 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.
     *
     * @param after the operation to perform after this operation
     * @return a composed `Consumer` that performs in sequence this
     * operation followed by the `after` operation
     * @throws NullPointerException if `after` is null
     */
    public fun andThen(after: Consumer): Consumer? {
        return Consumer { t: T ->
            accept(t)
            after.accept(t)
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy