简体   繁体   English

String Deduplication 与 String interning 有何不同

[英]In what way String Deduplication is different from String interning

As we know In Java String, process of storing and maintaining only one literal of any String is String interning.我们知道在 Java String 中,任何一个 String 只存储和维护一个字面量的过程就是 String interning。 I felt String Deduplication serves the same purpose when I read it first time.当我第一次阅读它时,我觉得 String Deduplication 具有相同的目的。

could some one explain Deduplication advantage over String intern?有人可以解释 Deduplication 相对于 String intern 的优势吗?

String interning happens only for constant strings and strings that you manually intern.字符串实习只发生在常量字符串和您手动实习的字符串上。

String deduplication happens automatically in the background for all strings, including ones you create at runtime.字符串重复数据删除在所有字符串的后台自动发生,包括您在运行时创建的字符串。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM