Skip to content

Instantly share code, notes, and snippets.

@charlesmuchene
Created April 16, 2020 04:00
Show Gist options
  • Save charlesmuchene/b53c1724b468c5d92893e2226fe95592 to your computer and use it in GitHub Desktop.
Save charlesmuchene/b53c1724b468c5d92893e2226fe95592 to your computer and use it in GitHub Desktop.
A function to create an un-synchronized lazy initialization of a property
/**
* Initialize lazily without thread synchronization
*
* @param initializer Initializer block
* @return [Lazy] instance
*/
fun <T> lazyNone(initializer: () -> T): Lazy<T> = lazy(LazyThreadSafetyMode.NONE, initializer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment