Package de.jungblut.datastructure
Class StringPool
- java.lang.Object
-
- de.jungblut.datastructure.StringPool
-
public final class StringPool extends java.lang.ObjectSimple map based StringPool that is considered faster than usingString.intern(), but uses a bit more memory.- Author:
- thomas.jungblut
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringPoolgetPool()static StringPoolgetSynchronizedPool()java.lang.Stringpool(java.lang.String s)Pools the given string and returns a reference to an existing string (if exists).
-
-
-
Method Detail
-
pool
public final java.lang.String pool(java.lang.String s)
Pools the given string and returns a reference to an existing string (if exists).- Parameters:
s- the string- Returns:
- a pooled string instance.
-
getPool
public static StringPool getPool()
- Returns:
- a not synchronized string pool based on a
HashMap.
-
getSynchronizedPool
public static StringPool getSynchronizedPool()
- Returns:
- a synchronized string pool based on a
ConcurrentHashMap.
-
-