I tried to look at Java’s String#intern() method, but it’s public native String intern();
In general, how is interning implemented? In String’s case?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For Sun Java, start with
JVM_InternString, on line ~3639 ofjvm.cpp. Technically, the actual String method is injava/lang/String.c, but it immediately callsJVM_InternString. You can continue toStringTable::interninsymbolTable.cpp.In a more abstract sense, the purpose of interning is to map equivalent strings to a single canonical one.