Package-level declarations

Types

Link copied to clipboard
class SafeThreadLazy<T>(val provider: () -> T) : Lazy<T>

Properties

Link copied to clipboard
val Double.isNegative: Boolean
val Float.isNegative: Boolean
val Int.isNegative: Boolean
val Long.isNegative: Boolean

Checking negativity.

Link copied to clipboard
val Double.isPositive: Boolean
val Float.isPositive: Boolean
val Int.isPositive: Boolean
val Long.isPositive: Boolean

Checking positivity.

Functions

Link copied to clipboard
inline fun <T> T.block(block: () -> Unit): T

Return the value before run the execution block.

Link copied to clipboard
fun <T> counter(content: Array<T>): Map<T, Int>

Calculate count of each value by group in the Array.

fun counter(content: BooleanArray): Map<Boolean, Int>

Calculate count of each value by group in the boolean array.

fun counter(content: ByteArray): Map<Byte, Int>

Calculate count of each value by group in the byte array.

fun counter(content: CharArray): Map<Char, Int>

Calculate count of each value by group in the char array.

fun counter(content: DoubleArray): Map<Double, Int>

Calculate count of each value by group in the double array.

fun counter(content: FloatArray): Map<Float, Int>

Calculate count of each value by group in the float array.

fun counter(content: IntArray): Map<Int, Int>

Calculate count of each value by group in the int array.

fun counter(content: LongArray): Map<Long, Int>

Calculate count of each value by group in the long array.

fun counter(content: ShortArray): Map<Short, Int>

Calculate count of each value by group in the short array.

fun counter(content: String): Map<Char, Int>

Calculate count of each value by group in the string.

fun <T> counter(content: Iterable<T>): Map<T, Int>

Calculate count of each value by group in the iterable.

Link copied to clipboard
inline fun <T, R> T?.ifNotNull(block: (T) -> R): R?

ifNotNull execute when value isn't null.

Link copied to clipboard
inline fun <T> T?.ifNull(block: (T?) -> Any): Any

ifNull execute when value is null.

Link copied to clipboard
fun <T> T?.isNotNull(): Boolean

Checking none nullability.

Link copied to clipboard
fun <T> T?.isNull(): Boolean

Checking nullability.

Link copied to clipboard
fun <T> T?.orDefault(default: T): T

when variable is null default value maintained.

Link copied to clipboard
fun Double?.orZero(): Double
fun Float?.orZero(): Float
fun Int?.orZero(): Int
fun Long?.orZero(): Long
fun Number?.orZero(): Number

Return zero when number is null.

Link copied to clipboard
inline fun <T> T.runBlock(block: () -> Unit): T

Return the value before run the execution block.

Link copied to clipboard
fun <T> safeThread(provider: () -> T): SafeThreadLazy<T>
Link copied to clipboard
inline fun tryCatchBool(block: () -> Boolean): Boolean

tryCatchBool used when you want to return a boolean value or return false if an exception is thrown.

Link copied to clipboard
inline fun tryCatchBoolean(block: () -> Unit): Boolean

tryCatchBoolean used when you want to return false if an exception is thrown.

Link copied to clipboard
inline fun <T> tryCatchElse(elseBlock: () -> T, block: () -> T): T

tryCatchElse used when you want to return a default value if an exception is thrown.

Link copied to clipboard
inline fun tryCatchIgnore(block: () -> Unit)

tryCatchIgnore used when you want to ignore catch block if an exception is thrown.

Link copied to clipboard
inline fun <T> tryCatchNull(block: () -> T): T?

tryCatchNull used when you want to return null if an exception is thrown.