Example usage for org.apache.commons.collections.map ReferenceIdentityMap ReferenceIdentityMap

List of usage examples for org.apache.commons.collections.map ReferenceIdentityMap ReferenceIdentityMap

Introduction

In this page you can find the example usage for org.apache.commons.collections.map ReferenceIdentityMap ReferenceIdentityMap.

Prototype

public ReferenceIdentityMap(int keyType, int valueType) 

Source Link

Document

Constructs a new ReferenceIdentityMap that will use the specified types of references.

Usage

From source file:com.google.gwt.dev.shell.designtime.WrappersCache.java

/**
 * Weakly caches a wrapper for a given Java Object.
 * //from w  w  w.j a  va2s.c  om
 * @param javaObject
 *            the Object being wrapped
 * @param wrapper
 *            the mapped wrapper
 */
@SuppressWarnings("unchecked")
public static void putWrapperForObject(ClassLoader cl, Object javaObject, Object wrapper) {
    Map<Object, Object> cache = m_javaWrapperCache.get(cl);
    if (cache == null) {
        cache = new ReferenceIdentityMap(AbstractReferenceMap.WEAK, AbstractReferenceMap.WEAK);
        m_javaWrapperCache.put(cl, cache);
    }
    cache.put(javaObject, wrapper);
}