Package com.adobe.xfa.ut
Class SymbolTable
java.lang.Object
com.adobe.xfa.ut.SymbolTable
This 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.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioninternSymbol(String symbol) Return an interned version of a symbol.
-
Constructor Details
-
SymbolTable
public SymbolTable()Constructs a new, empty SymbolTable.
-
-
Method Details
-
internSymbol
Return an interned version of a symbol.- Parameters:
symbol- a string to be interned.- Returns:
- the interned string.
-