08 August 2018

Java String.intern()


Although it's an old method/behavior, this feature is not very popular.
Java String has .intern() that points directly to String constant pool (pool of pointers, as C pointer) and can be used == instead .equals()(and it's faster)

More info:
https://www.geeksforgeeks.org/interning-of-string/

My Blog List

Blog Archive

Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.