public final class SymbolTable extends java.lang.ObjectThis class is used to optimize the use of String.intern() when it is used on a sequence of strings that are frequently repeated.
The call to String.intern() is a relatively expensive operation because of synchronization and the creation of weak references. This class caches strings that it has already interned to avoid calling repeating the call to intern.
The implementation uses a String to implement the hash table. The reason for using this implementation instead of a collection class is to avoid the overhead of creation of many entry objects, as most hash set implementations would do. This implementation also doesn't attempt to resize the table if it becomes full. In that case, it simply stops caching new entries, and falls back to simply interning any uncached strings.
Constructors Constructor Description
SymbolTable()Constructs a new, empty SymbolTable.
All Methods Instance Methods Concrete Methods Modifier and Type Method Description
internSymbol(java.lang.String symbol)Return an interned version of a symbol.