PairWrapper

interface PairWrapper<A, B> : ObjectWrapper<Pair<A, B>>

封装 Kotlin 标准库中的 kotlin.Pair,表示一个包含两个值的通用元组。

该接口用于在脚本环境中操作 Pair 对象,提供了访问其两个组成部分(first 和 second)的方法。

Author

M8Test, [email protected], https://m8test.com

Parameters

A

第一个值的类型。

B

第二个值的类型。

See also

Functions

Link copied to clipboard
abstract fun also(block: (Pair<A, B>) -> Unit): ObjectWrapper<Pair<A, B>>

对 ObjectWrapper 调用给定的 block 函数,并返回 ObjectWrapper 本身。

Link copied to clipboard
abstract fun apply(block: Pair<A, B>.() -> Unit): ObjectWrapper<Pair<A, B>>

对 ObjectWrapper 调用给定的 block 函数,并返回 ObjectWrapper 本身。

Link copied to clipboard
abstract fun getFirst(): A

获取元组中的第一个值。

Link copied to clipboard
abstract fun getOrigin(): Pair<A, B>

获取原始的对象.

Link copied to clipboard
abstract fun getSecond(): B

获取元组中的第二个值。

Link copied to clipboard
abstract fun <R> let(block: (Pair<A, B>) -> R): ObjectWrapper<R>?

对 ObjectWrapper 调用给定的 block 函数,并返回 block 函数的结果包装在 ObjectWrapper 中。

Link copied to clipboard
abstract fun <R> run(block: Pair<A, B>.() -> R): ObjectWrapper<R>?

对 ObjectWrapper 调用给定的 block 函数,并返回 block 函数的结果包装在 ObjectWrapper 中。

Link copied to clipboard
abstract fun setOrigin(origin: Pair<A, B>)

设置原始对象

Link copied to clipboard
abstract fun takeIf(predicate: (Pair<A, B>) -> Boolean): ObjectWrapper<Pair<A, B>>?

如果 ObjectWrapper 满足给定的 predicate,则返回 ObjectWrapper 本身,否则返回 null 包装在 ObjectWrapper? 中。

Link copied to clipboard
abstract fun takeUnless(predicate: (Pair<A, B>) -> Boolean): ObjectWrapper<Pair<A, B>>?

如果 ObjectWrapper 不满足给定的 predicate,则返回 ObjectWrapper 本身,否则返回 null 包装在 ObjectWrapper? 中。