Class StringCache

All Implemented Interfaces:
Iterable<String>, Collection<String>, Set<String>

public final class StringCache extends ShareableObjectCache<String>
This singleton class provides a pruneable cache for constant Strings that won't eat up the PermGen part of the Java JVM heap.
Author:
Andrew Pavlin, KA2DDO
  • Method Details

    • intern

      public static String intern(String s)
      Return the interned singleton copy of the specified String. If the String does not currently exist in the StringCache, it becomes the singleton.
      Parameters:
      s - String to look for interned copy
      Returns:
      interned String copy
    • getType

      protected Class<?> getType()
      Get data type of the objects stored in this ShareableObjectCache.
      Specified by:
      getType in class ShareableObjectCache<String>
      Returns:
      Class of stored objects