kotlin.Any

Any

open class Any

The root of the Kotlin class hierarchy. Every Kotlin class has Any as a superclass.

Constructors

<init>

Any()

The root of the Kotlin class hierarchy. Every Kotlin class has Any as a superclass.

Functions

equals

open operator fun equals(other: Any?): Boolean

Indicates whether some other object is "equal to" this one. Implementations must fulfil the following requirements:

hashCode

open fun hashCode(): Int

Returns a hash code value for the object. The general contract of hashCode is:

toString

open fun toString(): String

Returns a string representation of the object.

Extension Properties

javaClass

val <T : Any> T.javaClass: Class<T>

Returns the runtime Java class of this object.

Extension Functions

also

fun <T> T.also(block: (T) -> Unit): T

Calls the specified function block with this value as its argument and returns this value.

apply

fun <T> T.apply(block: T.() -> Unit): T

Calls the specified function block with this value as its receiver and returns this value.

asDynamic

fun Any?.asDynamic(): dynamic

Reinterprets this value as a value of the dynamic type.

iterator

operator fun dynamic.iterator(): Iterator<dynamic>

Allows to iterate this dynamic object in the following cases:

let

fun <T, R> T.let(block: (T) -> R): R

Calls the specified function block with this value as its argument and returns its result.

run

fun <T, R> T.run(block: T.() -> R): R

Calls the specified function block with this value as its receiver and returns its result.

takeIf

fun <T> T.takeIf(predicate: (T) -> Boolean): T?

Returns this value if it satisfies the given predicate or null, if it doesn't.

takeUnless

fun <T> T.takeUnless(predicate: (T) -> Boolean): T?

Returns this value if it does not satisfy the given predicate or null, if it does.

to

infix fun <A, B> A.to(that: B): Pair<A, B>

Creates a tuple of type Pair from this and that.

toString

fun Any?.toString(): String

Returns a string representation of the object. Can be called with a null receiver, in which case it returns the string "null".

unsafeCast

fun <T> Any?.unsafeCast(): T

Reinterprets this value as a value of the specified type T without any actual type checking.

© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部