extensions: add unsafeLazy
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
parent
4bc023ce3b
commit
6388bc7ac9
1 changed files with 3 additions and 0 deletions
|
@ -75,3 +75,6 @@ val RevCommit.time: Date
|
|||
fun String.splitLines(): Array<String> {
|
||||
return split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
|
||||
}
|
||||
|
||||
/** Alias to [lazy] with thread safety mode always set to [LazyThreadSafetyMode.NONE]. */
|
||||
fun <T> unsafeLazy(initializer: () -> T) = lazy(LazyThreadSafetyMode.NONE) { initializer.invoke() }
|
||||
|
|
Loading…
Reference in a new issue