kotlin
Package kotlin
Core functions and types, available on all supported platforms-
Types
interface Annotation Base interface implicitly implemented by all annotation interfaces. See Kotlin language documentation for more information on annotations. | |
open class Any The root of the Kotlin class hierarchy. Every Kotlin class has Any as a superclass. | |
class Array<T> Represents an array (specifically, a Java array when targeting the JVM platform). Array instances can be created using the arrayOf, arrayOfNulls and emptyArray standard library functions. See Kotlin language documentation for more information on arrays. | |
class Boolean : Comparable<Boolean> Represents a value which is either | |
class BooleanArray An array of booleans. When targeting the JVM, instances of this class are represented as | |
class Byte : Number, Comparable<Byte> Represents a 8-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type | |
class ByteArray An array of bytes. When targeting the JVM, instances of this class are represented as | |
class Char : Comparable<Char> Represents a 16-bit Unicode character. On the JVM, non-nullable values of this type are represented as values of the primitive type | |
class CharArray An array of chars. When targeting the JVM, instances of this class are represented as | |
interface CharSequence Represents a readable sequence of Char values. | |
interface Comparable<in T> Classes which inherit from this interface have a defined total ordering between their instances. | |
open class ConcurrentModificationException : RuntimeException | |
enum class DeprecationLevel Contains levels for deprecation levels. | |
class Double : Number, Comparable<Double> Represents a double-precision 64-bit IEEE 754 floating point number. On the JVM, non-nullable values of this type are represented as values of the primitive type | |
class DoubleArray An array of doubles. When targeting the JVM, instances of this class are represented as | |
abstract class Enum<E : Enum<E>> : Comparable<E> The common base class of all enum classes. See the Kotlin language documentation for more information on enum classes. | |
class Float : Number, Comparable<Float> Represents a single-precision 32-bit IEEE 754 floating point number. On the JVM, non-nullable values of this type are represented as values of the primitive type | |
class FloatArray An array of floats. When targeting the JVM, instances of this class are represented as | |
interface Function<out R> Represents a value of a functional type, such as a lambda, an anonymous function or a function reference. | |
class Int : Number, Comparable<Int> Represents a 32-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type | |
class IntArray An array of ints. When targeting the JVM, instances of this class are represented as | |
class KotlinVersion : Comparable<KotlinVersion> Represents a version of the Kotlin standard library. | |
interface Lazy<out T> Represents a value with lazy initialization. | |
enum class LazyThreadSafetyMode Specifies how a Lazy instance synchronizes access among multiple threads. | |
class Long : Number, Comparable<Long> Represents a 64-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type | |
class LongArray An array of longs. When targeting the JVM, instances of this class are represented as | |
open class NoWhenBranchMatchedException : RuntimeException | |
class Nothing Nothing has no instances. You can use Nothing to represent "a value that never exists": for example, if a function has the return type of Nothing, it means that it never returns (always throws an exception). | |
abstract class Number Superclass for all platform classes representing numeric values. | |
data class Pair<out A, out B> : Serializable Represents a generic pair of two values. | |
class Short : Number, Comparable<Short> Represents a 16-bit signed integer. On the JVM, non-nullable values of this type are represented as values of the primitive type | |
class ShortArray An array of shorts. When targeting the JVM, instances of this class are represented as | |
class String : Comparable<String>, CharSequence The | |
open class Throwable The base class for all errors and exceptions. Only instances of this class can be thrown or caught. | |
data class Triple<out A, out B, out C> : Serializable Represents a triad of values | |
object Unit The type with only one value: the Unit object. This type corresponds to the |
Annotations
annotation class Deprecated Marks the annotated class, function, property, variable or parameter as deprecated. | |
annotation class DslMarker When applied to annotation class X specifies that X defines a DSL language | |
annotation class ExtensionFunctionType Signifies that the annotated functional type represents an extension function. | |
annotation class ParameterName Annotates type arguments of functional type and holds corresponding parameter name specified by the user in type declaration (if any). | |
annotation class PublishedApi Specifies that this part of internal API is effectively public exposed by using in public inline function | |
annotation class ReplaceWith Specifies a code fragment that can be used to replace a deprecated function, property or class. Tools such as IDEs can automatically apply the replacements specified through this annotation. | |
annotation class SinceKotlin Specifies the first version of Kotlin where a declaration has appeared. Using the declaration and specifying an older API version (via the | |
annotation class Suppress Suppresses the given compilation warnings in the annotated element. | |
annotation class Synchronized | |
annotation class UnsafeVariance Suppresses errors about variance conflict | |
annotation class Volatile |
Exceptions
class NotImplementedError : Error An exception is thrown to indicate that a method body remains to be implemented. |
Type Aliases
typealias AssertionError = AssertionError | |
typealias ClassCastException = ClassCastException | |
typealias Comparator<T> = Comparator<T> | |
typealias Error = Error | |
typealias Exception = Exception | |
typealias IllegalArgumentException = IllegalArgumentException | |
typealias IllegalStateException = IllegalStateException | |
typealias IndexOutOfBoundsException = IndexOutOfBoundsException | |
typealias NoSuchElementException = NoSuchElementException | |
typealias NullPointerException = NullPointerException | |
typealias NumberFormatException = NumberFormatException | |
typealias RuntimeException = RuntimeException | |
typealias UnsupportedOperationException = UnsupportedOperationException |
Extensions for External Classes
Properties
val Throwable.stackTrace: Array<StackTraceElement> Returns an array of stack trace elements representing the stack trace pertaining to this throwable. |
Functions
fun <T> Comparator( comparison: (a: T, b: T) -> Int ): Comparator<T> | |
fun TODO(): Nothing fun TODO(reason: String): Nothing Always throws NotImplementedError stating that operation is not implemented. | |
fun Throwable.addSuppressed(exception: Throwable) When supported by the platform adds the specified exception to the list of exceptions that were suppressed in order to deliver this exception. | |
fun <T> T.also(block: (T) -> Unit): T Calls the specified function block with | |
fun <T> T.apply(block: T.() -> Unit): T Calls the specified function block with | |
fun <T> arrayOf(vararg elements: T): Array<T> Returns an array containing the specified elements. | |
fun <T> arrayOfNulls(size: Int): Array<T?> Returns an array of objects of the given type with the given size, initialized with null values. | |
fun assert(value: Boolean) Throws an AssertionError if the value is false and runtime assertions have been enabled on the JVM using the -ea JVM option. fun assert(value: Boolean, lazyMessage: () -> Any) Throws an AssertionError calculated by lazyMessage if the value is false and runtime assertions have been enabled on the JVM using the -ea JVM option. | |
fun booleanArrayOf(vararg elements: Boolean): BooleanArray Returns an array containing the specified boolean values. | |
fun byteArrayOf(vararg elements: Byte): ByteArray Returns an array containing the specified Byte numbers. | |
fun charArrayOf(vararg elements: Char): CharArray Returns an array containing the specified characters. | |
fun check(value: Boolean) Throws an IllegalStateException if the value is false. fun check(value: Boolean, lazyMessage: () -> Any) Throws an IllegalStateException with the result of calling lazyMessage if the value is false. | |
fun <T : Any> checkNotNull(value: T?): T Throws an IllegalStateException if the value is null. Otherwise returns the not null value. fun <T : Any> checkNotNull( value: T?, lazyMessage: () -> Any ): T Throws an IllegalStateException with the result of calling lazyMessage if the value is null. Otherwise returns the not null value. | |
fun doubleArrayOf(vararg elements: Double): DoubleArray Returns an array containing the specified Double numbers. | |
fun <T> emptyArray(): Array<T> Returns an empty array of the specified type T. | |
fun <T : Enum<T>> enumValueOf(name: String): T Returns an enum entry with specified name. | |
fun <T : Enum<T>> enumValues(): Array<T> Returns an array containing enum T entries. | |
fun error(message: Any): Nothing Throws an IllegalStateException with the given message. | |
fun floatArrayOf(vararg elements: Float): FloatArray Returns an array containing the specified Float numbers. | |
operator fun <T> Lazy<T>.getValue( thisRef: Any?, property: KProperty<*> ): T An extension to delegate a read-only property of type T to an instance of Lazy. | |
fun intArrayOf(vararg elements: Int): IntArray Returns an array containing the specified Int numbers. | |
fun Double.isFinite(): Boolean fun Float.isFinite(): Boolean Returns | |
fun Double.isInfinite(): Boolean fun Float.isInfinite(): Boolean Returns | |
fun Double.isNaN(): Boolean fun Float.isNaN(): Boolean Returns | |
fun <T> lazy(initializer: () -> T): Lazy<T> fun <T> lazy(lock: Any?, initializer: () -> T): Lazy<T> Creates a new instance of the Lazy that uses the specified initialization function initializer and the default thread-safety mode LazyThreadSafetyMode.SYNCHRONIZED. fun <T> lazy( mode: LazyThreadSafetyMode, initializer: () -> T ): Lazy<T> Creates a new instance of the Lazy that uses the specified initialization function initializer and thread-safety mode. | |
fun <T> lazyOf(value: T): Lazy<T> Creates a new instance of the Lazy that is already initialized with the specified value. | |
fun <T, R> T.let(block: (T) -> R): R Calls the specified function block with | |
fun longArrayOf(vararg elements: Long): LongArray Returns an array containing the specified Long numbers. | |
operator fun String?.plus(other: Any?): String Concatenates this string with the string representation of the given other object. If either the receiver or the other object are null, they are represented as the string "null". | |
fun Throwable.printStackTrace() Prints the stack trace of this throwable to the standard output. fun Throwable.printStackTrace(writer: PrintWriter) Prints the stack trace of this throwable to the specified writer. fun Throwable.printStackTrace(stream: PrintStream) Prints the stack trace of this throwable to the specified stream. | |
fun repeat(times: Int, action: (Int) -> Unit) Executes the given function action specified number of times. | |
fun require(value: Boolean) Throws an IllegalArgumentException if the value is false. fun require(value: Boolean, lazyMessage: () -> Any) Throws an IllegalArgumentException with the result of calling lazyMessage if the value is false. | |
fun <T : Any> requireNotNull(value: T?): T Throws an IllegalArgumentException if the value is null. Otherwise returns the not null value. fun <T : Any> requireNotNull( value: T?, lazyMessage: () -> Any ): T Throws an IllegalArgumentException with the result of calling lazyMessage if the value is null. Otherwise returns the not null value. | |
fun <R> run(block: () -> R): R Calls the specified function block and returns its result. fun <T, R> T.run(block: T.() -> R): R Calls the specified function block with | |
fun shortArrayOf(vararg elements: Short): ShortArray Returns an array containing the specified Short numbers. | |
fun <R> synchronized(lock: Any, block: () -> R): R Executes the given function block while holding the monitor of the given object lock. | |
fun <T> T.takeIf(predicate: (T) -> Boolean): T? Returns | |
fun <T> T.takeUnless(predicate: (T) -> Boolean): T? Returns | |
infix fun <A, B> A.to(that: B): Pair<A, B> | |
fun <T> Pair<T, T>.toList(): List<T> Converts this pair into a list. fun <T> Triple<T, T, T>.toList(): List<T> Converts this triple into a list. | |
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". | |
fun <T : AutoCloseable?, R> T.use(block: (T) -> R): R Executes the given block function on this resource and then closes it down correctly whether an exception is thrown or not. | |
fun <T, R> with(receiver: T, block: T.() -> R): R Calls the specified function block with the given receiver as its receiver and returns its result. |
© 2010–2017 JetBrains s.r.o.
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/