Hi Abhinav,
Thanks for the article, it helps to understand Flyweight DP with examples.
Please clarify one doubt that I have. For the ProductCache, don’t we need to add the newly instantiated “product” to the “productMap” before returning it so that the following lookups always return the cached instance?
Hi Abhinav,
Thanks for the article, it helps to understand Flyweight DP with examples.
Please clarify one doubt that I have. For the ProductCache, don’t we need to add the newly instantiated “product” to the “productMap” before returning it so that the following lookups always return the cached instance?
Correct. Thanks for the correction.