Package com.ctc.wstx.util
Class InternCache
- All Implemented Interfaces:
Serializable,Cloneable,Map<String,,String> SequencedMap<String,String>
Singleton class that implements "fast intern" functionality, essentially
adding a layer that caches Strings that have been previously intern()ed,
but that probably shouldn't be added to symbol tables.
This is usually used by improving intern()ing of things like namespace
URIs.
Note: that this class extends LinkedHashMap is an implementation
detail -- no code should ever directly call Map methods.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intLet's create cache big enough to usually have enough space for all entries...private static final intLet's limit to hash area size of 1024.private static final InternCache -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InternCacheprotected booleanremoveEldestEntry(Map.Entry<String, String> eldest) Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Field Details
-
DEFAULT_SIZE
private static final int DEFAULT_SIZELet's create cache big enough to usually have enough space for all entries... (assuming NS URIs only)- See Also:
-
MAX_SIZE
private static final int MAX_SIZELet's limit to hash area size of 1024.- See Also:
-
sInstance
-
-
Constructor Details
-
InternCache
private InternCache()
-
-
Method Details
-
getInstance
-
intern
-
removeEldestEntry
- Overrides:
removeEldestEntryin classLinkedHashMap<String,String>
-