Package dev.inmo.micro_utils.common

Types

ByteArrayAllocator
Link copied to clipboard
typealias ByteArrayAllocator = () -> ByteArray
typealias ByteArrayAllocator = () -> ByteArray
typealias ByteArrayAllocator = () -> ByteArray
ByteArrayAllocatorSerializer
Link copied to clipboard
object ByteArrayAllocatorSerializer : KSerializer<ByteArrayAllocator>
object ByteArrayAllocatorSerializer : KSerializer<ByteArrayAllocator>
object ByteArrayAllocatorSerializer : KSerializer<ByteArrayAllocator>
Diff
Link copied to clipboard
data class Diff<T>

Diff object which contains information about differences between two Iterables

data class Diff<T>

Diff object which contains information about differences between two Iterables

data class Diff<T>

Diff object which contains information about differences between two Iterables

Either
Link copied to clipboard
interface Either<T1, T2>

Realization of this interface will contains at least one not null - t1 or t2

interface Either<T1, T2>

Realization of this interface will contains at least one not null - t1 or t2

interface Either<T1, T2>

Realization of this interface will contains at least one not null - t1 or t2

EitherFirst
Link copied to clipboard
data class EitherFirst<T1, T2>(t1: T1) : Either<T1, T2>

This type Either will always have not nullable t1

data class EitherFirst<T1, T2>(t1: T1) : Either<T1, T2>

This type Either will always have not nullable t1

data class EitherFirst<T1, T2>(t1: T1) : Either<T1, T2>

This type Either will always have not nullable t1

EitherSecond
Link copied to clipboard
data class EitherSecond<T1, T2>(t2: T2) : Either<T1, T2>

This type Either will always have not nullable t2

data class EitherSecond<T1, T2>(t2: T2) : Either<T1, T2>

This type Either will always have not nullable t2

data class EitherSecond<T1, T2>(t2: T2) : Either<T1, T2>

This type Either will always have not nullable t2

EitherSerializer
Link copied to clipboard
class EitherSerializer<T1, T2>(t1Serializer: KSerializer<T1>, t2Serializer: KSerializer<T2>) : KSerializer<Either<T1, T2>>
class EitherSerializer<T1, T2>(t1Serializer: KSerializer<T1>, t2Serializer: KSerializer<T2>) : KSerializer<Either<T1, T2>>
class EitherSerializer<T1, T2>(t1Serializer: KSerializer<T1>, t2Serializer: KSerializer<T2>) : KSerializer<Either<T1, T2>>
FileName
Link copied to clipboard
value class FileName(string: String)
value class FileName(string: String)
value class FileName(string: String)
MPPFile
Link copied to clipboard
expect class MPPFile
expect class MPPFile
expect class MPPFile
Optional
Link copied to clipboard
data class Optional<T>

This type represents T as not only potentially nullable data, but also as a data which can not be presented. This type will be useful in cases when T is nullable and null as valuable data too in time of data absence should be presented by some third type.

data class Optional<T>

This type represents T as not only potentially nullable data, but also as a data which can not be presented. This type will be useful in cases when T is nullable and null as valuable data too in time of data absence should be presented by some third type.

data class Optional<T>

This type represents T as not only potentially nullable data, but also as a data which can not be presented. This type will be useful in cases when T is nullable and null as valuable data too in time of data absence should be presented by some third type.

SuspendByteArrayAllocator
Link copied to clipboard
typealias SuspendByteArrayAllocator = suspend () -> ByteArray
typealias SuspendByteArrayAllocator = suspend () -> ByteArray
typealias SuspendByteArrayAllocator = suspend () -> ByteArray

Functions

asAllocator
Link copied to clipboard
suspend fun SuspendByteArrayAllocator.asAllocator(): ByteArrayAllocator
suspend fun SuspendByteArrayAllocator.asAllocator(): ByteArrayAllocator
suspend fun SuspendByteArrayAllocator.asAllocator(): ByteArrayAllocator
bytes
Link copied to clipboard
suspend fun MPPFile.bytes(): ByteArray
suspend fun MPPFile.bytes(): ByteArray
suspend fun MPPFile.bytes(): ByteArray
bytesSync
Link copied to clipboard
fun MPPFile.bytesSync(): ByteArray
fun MPPFile.bytesSync(): ByteArray
fun MPPFile.bytesSync(): ByteArray
calculateDiff
Link copied to clipboard
fun <T> Iterable<T>.calculateDiff(other: Iterable<T>, strictComparison: Boolean = false): Diff<T>

Calculating Diff object

fun <T> Iterable<T>.calculateDiff(other: Iterable<T>, strictComparison: Boolean = false): Diff<T>

Calculating Diff object

fun <T> Iterable<T>.calculateDiff(other: Iterable<T>, strictComparison: Boolean = false): Diff<T>

Calculating Diff object

calculateStrictDiff
Link copied to clipboard
inline fun <T> Iterable<T>.calculateStrictDiff(other: Iterable<T>): Diff<T>

This method call calculateDiff with strict mode enabled

inline fun <T> Iterable<T>.calculateStrictDiff(other: Iterable<T>): Diff<T>

This method call calculateDiff with strict mode enabled

inline fun <T> Iterable<T>.calculateStrictDiff(other: Iterable<T>): Diff<T>

This method call calculateDiff with strict mode enabled

changeVisibility
Link copied to clipboard
fun View.changeVisibility(show: Boolean = !isShown, goneOnHide: Boolean = true)
collapse
Link copied to clipboard
fun View.collapse(duration: Long = 500)
collapseHorizontally
Link copied to clipboard
fun View.collapseHorizontally(duration: Long = 500)
dataOrElse
Link copied to clipboard
inline fun <T> Optional<T>.dataOrElse(block: () -> T): T

Returns Optional.data if Optional.dataPresented of this is true, or call block and returns the result of it

inline fun <T> Optional<T>.dataOrElse(block: () -> T): T

Returns Optional.data if Optional.dataPresented of this is true, or call block and returns the result of it

inline fun <T> Optional<T>.dataOrElse(block: () -> T): T

Returns Optional.data if Optional.dataPresented of this is true, or call block and returns the result of it

dataOrNull
Link copied to clipboard
fun <T> Optional<T>.dataOrNull(): T?

Returns Optional.data if Optional.dataPresented of this is true, or null otherwise

fun <T> Optional<T>.dataOrNull(): T?

Returns Optional.data if Optional.dataPresented of this is true, or null otherwise

fun <T> Optional<T>.dataOrNull(): T?

Returns Optional.data if Optional.dataPresented of this is true, or null otherwise

dataOrThrow
Link copied to clipboard
fun <T> Optional<T>.dataOrThrow(throwable: Throwable): T

Returns Optional.data if Optional.dataPresented of this is true, or throw throwable otherwise

fun <T> Optional<T>.dataOrThrow(throwable: Throwable): T

Returns Optional.data if Optional.dataPresented of this is true, or throw throwable otherwise

fun <T> Optional<T>.dataOrThrow(throwable: Throwable): T

Returns Optional.data if Optional.dataPresented of this is true, or throw throwable otherwise

Diff
Link copied to clipboard
inline fun <T> Iterable<T>.diff(other: Iterable<T>, strictComparison: Boolean = false): Diff<T>
inline fun <T> Iterable<T>.diff(other: Iterable<T>, strictComparison: Boolean = false): Diff<T>
inline fun <T> Iterable<T>.diff(other: Iterable<T>, strictComparison: Boolean = false): Diff<T>
disable
Link copied to clipboard
fun View.disable()
either
Link copied to clipboard
inline fun <T1, T2> Any.either(): Either<T1, T2>
inline fun <T1, T2> Any.either(): Either<T1, T2>
inline fun <T1, T2> Any.either(): Either<T1, T2>
enable
Link copied to clipboard
fun View.enable()
expand
Link copied to clipboard
fun View.expand(duration: Long = 500, targetWidth: Int = ViewGroup.LayoutParams.MATCH_PARENT, targetHeight: Int = ViewGroup.LayoutParams.WRAP_CONTENT)
expandHorizontally
Link copied to clipboard
fun View.expandHorizontally(duration: Long = 500, targetWidth: Int = ViewGroup.LayoutParams.MATCH_PARENT, targetHeight: Int = ViewGroup.LayoutParams.WRAP_CONTENT)
first
Link copied to clipboard
inline fun <T1, T2> Either.Companion.first(t1: T1): Either<T1, T2>
inline fun <T1, T2> Either.Companion.first(t1: T1): Either<T1, T2>
inline fun <T1, T2> Either.Companion.first(t1: T1): Either<T1, T2>
firstNotNull
Link copied to clipboard
fun <T> Iterable<T?>.firstNotNull(): T
fun <T> Iterable<T?>.firstNotNull(): T
fun <T> Iterable<T?>.firstNotNull(): T
getDp
Link copied to clipboard
inline fun Resources.getDp(resId: Int): Float
getSp
Link copied to clipboard
inline fun Resources.getSp(resId: Int): Float
gone
Link copied to clipboard
inline fun View.gone()
hide
Link copied to clipboard
inline fun View.hide()
intersect
Link copied to clipboard
fun <T : Comparable<T>> ClosedRange<T>.intersect(other: ClosedRange<T>): Pair<T, T>?
fun IntRange.intersect(other: IntRange): IntRange?
fun LongRange.intersect(other: LongRange): LongRange?
fun <T : Comparable<T>> ClosedRange<T>.intersect(other: ClosedRange<T>): Pair<T, T>?
fun IntRange.intersect(other: IntRange): IntRange?
fun LongRange.intersect(other: LongRange): LongRange?
fun <T : Comparable<T>> ClosedRange<T>.intersect(other: ClosedRange<T>): Pair<T, T>?
fun IntRange.intersect(other: IntRange): IntRange?
fun LongRange.intersect(other: LongRange): LongRange?
joinTo
Link copied to clipboard
inline fun <I> Iterable<I>.joinTo(separator: I? = null, prefix: I? = null, postfix: I? = null): List<I>
inline fun <I> Iterable<I>.joinTo(separatorFun: (I) -> I?, prefix: I? = null, postfix: I? = null): List<I>
inline fun <I, R> Array<I>.joinTo(separator: R? = null, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): Array<R>
inline fun <I, R> Array<I>.joinTo(separatorFun: (I) -> R?, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): Array<R>
inline fun <I, R> Iterable<I>.joinTo(separator: R? = null, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): List<R>
inline fun <I, R> Iterable<I>.joinTo(separatorFun: (I) -> R?, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): List<R>
inline fun <I> Iterable<I>.joinTo(separator: I? = null, prefix: I? = null, postfix: I? = null): List<I>
inline fun <I> Iterable<I>.joinTo(separatorFun: (I) -> I?, prefix: I? = null, postfix: I? = null): List<I>
inline fun <I, R> Array<I>.joinTo(separator: R? = null, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): Array<R>
inline fun <I, R> Array<I>.joinTo(separatorFun: (I) -> R?, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): Array<R>
inline fun <I, R> Iterable<I>.joinTo(separator: R? = null, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): List<R>
inline fun <I, R> Iterable<I>.joinTo(separatorFun: (I) -> R?, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): List<R>
inline fun <I> Iterable<I>.joinTo(separator: I? = null, prefix: I? = null, postfix: I? = null): List<I>
inline fun <I> Iterable<I>.joinTo(separatorFun: (I) -> I?, prefix: I? = null, postfix: I? = null): List<I>
inline fun <I, R> Array<I>.joinTo(separator: R? = null, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): Array<R>
inline fun <I, R> Array<I>.joinTo(separatorFun: (I) -> R?, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): Array<R>
inline fun <I, R> Iterable<I>.joinTo(separator: R? = null, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): List<R>
inline fun <I, R> Iterable<I>.joinTo(separatorFun: (I) -> R?, prefix: R? = null, postfix: R? = null, transform: (I) -> R?): List<R>
mapNotNullA
Link copied to clipboard
inline fun <T, R> Array<T>.mapNotNullA(mapper: (T) -> R?): List<R>
inline fun <T, R> Iterable<T>.mapNotNullA(transform: (T) -> R?): List<R>
mapOnAbsent
Link copied to clipboard
inline fun <T, R> Optional<T>.mapOnAbsent(block: () -> R): R?

Will call block when data presented (Optional.dataPresented == true)

inline fun <T, R> Optional<T>.mapOnAbsent(block: () -> R): R?

Will call block when data presented (Optional.dataPresented == true)

inline fun <T, R> Optional<T>.mapOnAbsent(block: () -> R): R?

Will call block when data presented (Optional.dataPresented == true)

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

Will call block when data presented (Optional.dataPresented == true)

inline fun <T, R> Optional<T>.mapOnPresented(block: (T) -> R): R?

Will call block when data presented (Optional.dataPresented == true)

inline fun <T, R> Optional<T>.mapOnPresented(block: (T) -> R): R?

Will call block when data presented (Optional.dataPresented == true)

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

Will call block when data absent (Optional.dataPresented == false)

inline fun <T> Optional<T>.onAbsent(block: () -> Unit): Optional<T>

Will call block when data absent (Optional.dataPresented == false)

inline fun <T> Optional<T>.onAbsent(block: () -> Unit): Optional<T>

Will call block when data absent (Optional.dataPresented == false)

onFirst
Link copied to clipboard
inline fun <T1, T2, E : Either<T1, T2>> E.onFirst(block: (T1) -> Unit): E

Will call block in case when Either.t1 of this is not null

inline fun <T1, T2, E : Either<T1, T2>> E.onFirst(block: (T1) -> Unit): E

Will call block in case when Either.t1 of this is not null

inline fun <T1, T2, E : Either<T1, T2>> E.onFirst(block: (T1) -> Unit): E

Will call block in case when Either.t1 of this is not null

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

Will call block when data presented (Optional.dataPresented == true)

inline fun <T> Optional<T>.onPresented(block: (T) -> Unit): Optional<T>

Will call block when data presented (Optional.dataPresented == true)

inline fun <T> Optional<T>.onPresented(block: (T) -> Unit): Optional<T>

Will call block when data presented (Optional.dataPresented == true)

onSecond
Link copied to clipboard
inline fun <T1, T2, E : Either<T1, T2>> E.onSecond(block: (T2) -> Unit): E

Will call block in case when Either.t2 of this is not null

inline fun <T1, T2, E : Either<T1, T2>> E.onSecond(block: (T2) -> Unit): E

Will call block in case when Either.t2 of this is not null

inline fun <T1, T2, E : Either<T1, T2>> E.onSecond(block: (T2) -> Unit): E

Will call block in case when Either.t2 of this is not null

repeatOnFailure
Link copied to clipboard
inline fun <R> repeatOnFailure(times: Int, onEachFailure: (Throwable) -> Unit = {}, action: (Int) -> R): Optional<R>

Executes the given action until getting of successful result specified number of times.

inline fun <R> repeatOnFailure(times: Int, onEachFailure: (Throwable) -> Unit = {}, action: (Int) -> R): Optional<R>

Executes the given action until getting of successful result specified number of times.

inline fun <R> repeatOnFailure(times: Int, onEachFailure: (Throwable) -> Unit = {}, action: (Int) -> R): Optional<R>

Executes the given action until getting of successful result specified number of times.

second
Link copied to clipboard
inline fun <T1, T2> Either.Companion.second(t2: T2): Either<T1, T2>
inline fun <T1, T2> Either.Companion.second(t2: T2): Either<T1, T2>
inline fun <T1, T2> Either.Companion.second(t2: T2): Either<T1, T2>
show
Link copied to clipboard
inline fun View.show()
StrictDiff
Link copied to clipboard
inline fun <T> StrictDiff(old: Iterable<T>, new: Iterable<T>): Diff<T>
inline fun <T> StrictDiff(old: Iterable<T>, new: Iterable<T>): Diff<T>
inline fun <T> StrictDiff(old: Iterable<T>, new: Iterable<T>): Diff<T>
toggleEnabledState
Link copied to clipboard
fun View.toggleEnabledState(enabled: Boolean)
toggleExpandHorizontallyState
Link copied to clipboard
fun View.toggleExpandHorizontallyState(duration: Long = 500): Boolean
toggleExpandState
Link copied to clipboard
fun View.toggleExpandState(duration: Long = 500): Boolean
toggleVisibility
Link copied to clipboard
fun View.toggleVisibility(goneOnHide: Boolean = true)

Properties

asAllocator
Link copied to clipboard
val ByteArray.asAllocator: ByteArrayAllocator
asAllocator
Link copied to clipboard
val ByteArray.asAllocator: ByteArrayAllocator
asAllocator
Link copied to clipboard
val ByteArray.asAllocator: ByteArrayAllocator
asSuspendAllocator
Link copied to clipboard
asSuspendAllocator
Link copied to clipboard
asSuspendAllocator
Link copied to clipboard
asSuspendAllocator
Link copied to clipboard
asSuspendAllocator
Link copied to clipboard
asSuspendAllocator
Link copied to clipboard
bytesAllocator
Link copied to clipboard
expect val MPPFile.bytesAllocator: SuspendByteArrayAllocator
bytesAllocator
Link copied to clipboard
expect val MPPFile.bytesAllocator: SuspendByteArrayAllocator
bytesAllocator
Link copied to clipboard
expect val MPPFile.bytesAllocator: SuspendByteArrayAllocator
bytesAllocatorSync
Link copied to clipboard
expect val MPPFile.bytesAllocatorSync: ByteArrayAllocator
bytesAllocatorSync
Link copied to clipboard
expect val MPPFile.bytesAllocatorSync: ByteArrayAllocator
bytesAllocatorSync
Link copied to clipboard
expect val MPPFile.bytesAllocatorSync: ByteArrayAllocator
disabled
Link copied to clipboard
val View.disabled: Boolean
enabled
Link copied to clipboard
val View.enabled: Boolean
filename
Link copied to clipboard
expect val MPPFile.filename: FileName
filename
Link copied to clipboard
expect val MPPFile.filename: FileName
filename
Link copied to clipboard
expect val MPPFile.filename: FileName
filesize
Link copied to clipboard
expect val MPPFile.filesize: Long
filesize
Link copied to clipboard
expect val MPPFile.filesize: Long
filesize
Link copied to clipboard
expect val MPPFile.filesize: Long
gone
Link copied to clipboard
val View.gone: Boolean
hidden
Link copied to clipboard
val View.hidden: Boolean
isCollapsed
Link copied to clipboard
val View.isCollapsed: Boolean
isExpanded
Link copied to clipboard
val View.isExpanded: Boolean
optional
Link copied to clipboard
val <T> T.optional: Optional<T>
optional
Link copied to clipboard
val <T> T.optional: Optional<T>
optional
Link copied to clipboard
val <T> T.optional: Optional<T>
shown
Link copied to clipboard
val View.shown: Boolean