public final class SymbolTable extends Object
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 and Description |
|---|
SymbolTable()
Constructs a new, empty SymbolTable.
|
| Modifier and Type | Method and Description |
|---|---|
String |
internSymbol(String symbol)
Return an interned version of a symbol.
|
Copyright © 2010 - 2020 Adobe. All Rights Reserved