Class SegmentConstantPoolArrayCache

java.lang.Object
org.apache.commons.compress.harmony.unpack200.SegmentConstantPoolArrayCache

The SegmentConstantPool spends a lot of time searching through large arrays of Strings looking for matches. This can be sped up by caching the arrays in HashMaps so the String keys are looked up and resolve to positions in the array rather than iterating through the arrays each time. Because the arrays only grow (never shrink or change) we can use the last known size as a way to determine if the array has changed. Note that this cache must be synchronized externally if it is shared.