diff options
author | Harsh Shandilya <me@msfjarvis.dev> | 2021-05-30 02:18:00 +0530 |
---|---|---|
committer | Harsh Shandilya <me@msfjarvis.dev> | 2021-05-30 02:20:58 +0530 |
commit | 6388bc7ac93d3b302abe6598cfc6eef70a9fea3d (patch) | |
tree | b4f54ea1838fb4d786a4ceafffd3411aae8de5fc | |
parent | 4bc023ce3bb108913816c91b383872f999c8c0c8 (diff) |
extensions: add unsafeLazy
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
-rw-r--r-- | app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt b/app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt index a6d0066c..f04dba33 100644 --- a/app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt +++ b/app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt @@ -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() } |