Example usage for java.util WeakHashMap WeakHashMap

List of usage examples for java.util WeakHashMap WeakHashMap

Introduction

In this page you can find the example usage for java.util WeakHashMap WeakHashMap.

Prototype

public WeakHashMap() 

Source Link

Document

Constructs a new, empty WeakHashMap with the default initial capacity (16) and load factor (0.75).

Usage

From source file:Main.java

/**
 * There is currently no class in Java for a weak set, but it can be created as a set wrapping a weak map as in the body of the method below.
 * @return a weak set//w ww.  ja va 2  s . c  o  m
 */
public static <T> Set<T> createWeakSet() {
    return Collections.newSetFromMap(new WeakHashMap<T, Boolean>());
}

From source file:Main.java

public static <K, V> WeakHashMap<K, V> createWeakHashMap(Map<? extends K, ? extends V> map) {
    if (map == null) {
        return new WeakHashMap<K, V>();
    }/*  w  ww .j  a v a 2s . c  o  m*/

    return new WeakHashMap<K, V>(map);
}

From source file:Main.java

public static <K, V> WeakHashMap<K, V> newWeakHashMap() {
    return new WeakHashMap<K, V>();
}

From source file:WeakHashSet.java

public WeakHashSet() {
    map = new WeakHashMap();
}

From source file:br.com.hyperclass.snackbar.infrastructure.persist.UserSnackPersist.java

public UserSnackPersist() {
    super();
    this.user = new WeakHashMap<>();
    setUserSnac();
}

From source file:com.appspresso.api.fs.DefaultFileSystem.java

/**
 * {@inheritDoc}/*from  ww w .  j a  v a  2  s . co m*/
 */
@Override
public void onMount(String prefix, Properties options) {
    if (!rootDirectory.isDirectory()) {
        if (L.isDebugEnabled()) {
            L.debug("The root is invalid.");
        }
        return;
    }

    rootAxFile = new DefaultFile(this, rootDirectory, prefix);
    cache = new WeakHashMap<String, DefaultFile>();
    setRead(/* rootAxFile.canRead() */true);
    setWrite(/* rootAxFile.canWrite() */true);
}

From source file:com.swavdev.tc.DrawableManager.java

public DrawableManager() {
    drawableMap = new WeakHashMap<String, Drawable>();
    executorService = Executors.newFixedThreadPool(5);
}

From source file:com.uimirror.location.conf.WebAppInitializer.java

@Bean
public ServletRegistrationBean dispatcherServletRegistration() {
    ServletRegistrationBean registration = new ServletRegistrationBean(dispatcherServlet());
    Map<String, String> params = new WeakHashMap<String, String>();
    params.put("javax.ws.rs.Application", "com.uimirror.location.conf.JerssyApplicationInitializer");
    //params.put("jersey.config.server.provider.classnames","com.uimirror.api.filter.SecurityContextFilter,com.uimirror.challenge.config.filter.UimCORSFilter, com.uimirror.api.filter.PoweredByResponseFilter");
    registration.setInitParameters(params);
    registration.addUrlMappings("/*");
    return registration;
}

From source file:com.appspresso.api.fs.AssetFileSystem.java

/**
 * {@inheritDoc}//from w w w  .  j  a v  a  2 s. co  m
 */
@Override
public void onMount(String prefix, Properties options) {
    if (FileSystemUtils.isEmptyPath(rootAssetPath)) {
        if (L.isDebugEnabled())
            L.debug("The root cannot be mounted.");
        return;
    }

    AssetFilePeer peer = new AssetFilePeer(assetManager, rootAssetPath);
    if (!peer.exists()) {
        if (L.isDebugEnabled())
            L.debug("The root is invalid.");
        return;
    }

    if (!peer.isDirectory()) {
        if (L.isDebugEnabled())
            L.debug("The root is not a directory.");
        return;
    }

    // rootAxFile = new AssetFile(this, null /* no parent */, peer);
    rootAxFile = new AssetFile(this, peer, prefix);
    cache = new WeakHashMap<String, AssetFile>();
    canRead = true;
}

From source file:sk.stuba.fiit.kvasnicka.qsimsimulation.managers.TopologyManager.java

public TopologyManager(List<Edge> edgeList, List<NetworkNode> nodeList) {
    this.nodeList = Collections.unmodifiableList(nodeList);
    this.edgeList = Collections.unmodifiableList(edgeList);

    edgeCache = new WeakHashMap<CacheKey, Edge>();
}