Ie. return the previous instace if it exists and o...
# announcements
k
Ie. return the previous instace if it exists and otherwise create a new one and remember it.
u
It seems that I misunderstood
lazy
initialization. I’ve just thought that ‘lazy’ initialized object will be really initialized as soon it gets used.
k
Could you not create a thread for every message? It's fine to talk top-level.
But yes, lazy means that an object is created the first time you use it and any requests after that get the same instance back.
u
Thanks. How would you rewrite
get
(in the code above) in a more concise way using lazy?
k
You can't unfortunately,
Lazy
can't be reset.
See my example code above for what I'd do.
u
Thanks for help.