Is Java's String Intern a flyweight?

后端 未结 6 1459
醉酒成梦
醉酒成梦 2020-12-11 02:10

Does the implementation of Java\'s String memory pool follows flyweight pattern?

Why I have this doubt is, I see that there is no extrinsic state involved in Intern.

6条回答
  •  醉话见心
    2020-12-11 02:26

    Flyweight is about sharing the object immmutables internals . Interning is just caching the whole objects.

提交回复
热议问题