Skip to content

Instantly share code, notes, and snippets.

@deepakmehra10
Created July 14, 2019 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepakmehra10/77a958b62ae16796bc15f169ac9fb0d4 to your computer and use it in GitHub Desktop.
Save deepakmehra10/77a958b62ae16796bc15f169ac9fb0d4 to your computer and use it in GitHub Desktop.
Lazy<String> name = Lazy.of(() -> "Deepak");
System.out.println(name.isEvaluated()); //false
System.out.println(name.get()); //Deepak
System.out.println(name.isEvaluated()); //True
System.out.println(name.get()); //Deepak, from cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment