org.jacoco.core.analysis
Class StringPool

java.lang.Object
  extended by org.jacoco.core.analysis.StringPool

public final class StringPool
extends Object

Utility to normalize String instances in a way that if equals() is true for two strings they will be represented the same instance. While this is exactly what String.intern() does, this implementation avoids VM specific side effects and is supposed to be faster, as neither native code is called nor synchronization is required for concurrent lookup.

Version:
0.4.1.20101007204400
Author:
Marc R. Hoffmann

Constructor Summary
StringPool()
           
 
Method Summary
 String get(String s)
          Returns a normalized instance that is equal to the given String .
 String[] get(String[] arr)
          Returns a modified version of the array with all string slots normalized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringPool

public StringPool()
Method Detail

get

public String get(String s)
Returns a normalized instance that is equal to the given String .

Parameters:
s - any string or null
Returns:
normalized instance or null

get

public String[] get(String[] arr)
Returns a modified version of the array with all string slots normalized. It is up to the implementation to replace strings in the array instance or return a new array instance.

Parameters:
arr - String array or null
Returns:
normalized instance or null