Package com.ctc.wstx.util
Class InternCache
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<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 int
Let's create cache big enough to usually have enough space for all entries...private static final int
Let's limit to hash area size of 1024.private static final InternCache
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InternCache
protected boolean
removeEldestEntry
(Map.Entry<String, String> eldest) Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
Methods inherited from class java.util.HashMap
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Map
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
-
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:
removeEldestEntry
in classLinkedHashMap<String,
String>
-