Last active
August 29, 2015 14:17
-
-
Save ademar111190/fca309fc9fee1b0800d5 to your computer and use it in GitHub Desktop.
One month with Kotlin: lazy example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using Lazy on Kotlin | |
private val foo by Delegates.lazy { Foo(getContext()) } | |
//------------------------------------------------------------------------------ | |
// Using the nearest from Lazy in Java 7 | |
private Foo mFoo; | |
public Foo getFoo() { | |
if (mFoo == null) { | |
mFoo = new Foo(getContext()); | |
} | |
return mFoo; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment