com.sibvisions.util
Class Internalize

java.lang.Object
  extended by com.sibvisions.util.Internalize

public final class Internalize
extends Object

Intern functionality for all immutable Objects. It's about 2 times faster than String.intern().


Method Summary
static
<T> T
intern(T pObject)
          Internalizes any Immutable Object.
static
<T> T
internNoSync(T pObject)
          Internalizes any Immutable Object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

intern

public static final <T> T intern(T pObject)
Internalizes any Immutable Object. The function is synchronized.

Type Parameters:
T - any immutable Object.
Parameters:
pObject - the Object to internalize.
Returns:
the internalized Object.

internNoSync

public static final <T> T internNoSync(T pObject)
Internalizes any Immutable Object. The function is not synchronized. It is provided for fast usage, in loops. The implementation has to be like:
   synchronized(Internalize.class)
   {
      ... 
        ... = Internalize.internNoSync(...);
      ...
   }
 

Type Parameters:
T - any immutable Object.
Parameters:
pObject - the Object to internalize.
Returns:
the internalized Object.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.