Example usage for java.util WeakHashMap containsKey

List of usage examples for java.util WeakHashMap containsKey

Introduction

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

Prototype

public boolean containsKey(Object key) 

Source Link

Document

Returns true if this map contains a mapping for the specified key.

Usage

From source file:Main.java

public static void main(String[] args) {
    WeakHashMap<String, String> weakHashMap = new WeakHashMap<String, String>();

    weakHashMap.put("1", "first");
    weakHashMap.put("2", "two");
    weakHashMap.put("3", "from java2s.com");

    // check key value 
    System.out.println("Checking value for key 1");
    System.out.println(weakHashMap.containsKey("1"));
}

From source file:com.benefit.buy.library.http.query.callback.BitmapAjaxCallback.java

@Override
public final void callback(String url, Bitmap bm, AjaxStatus status) {
    ImageView firstView = v.get();
    WeakHashMap<ImageView, BitmapAjaxCallback> ivs = queueMap.remove(url);
    //check if view queue already contains first view 
    if ((ivs == null) || !ivs.containsKey(firstView)) {
        checkCb(this, url, firstView, bm, status);
    }/*from  w w w . ja  va2  s  . c  om*/
    if (ivs != null) {
        Set<ImageView> set = ivs.keySet();
        for (ImageView view : set) {
            BitmapAjaxCallback cb = ivs.get(view);
            cb.status = status;
            checkCb(cb, url, view, bm, status);
        }
    }
}

From source file:com.appbase.androidquery.callback.BitmapAjaxCallback.java

@Override
public final void callback(String url, Bitmap bm, AjaxStatus status) {

    ImageView firstView = v.get();
    WeakHashMap<ImageView, BitmapAjaxCallback> ivs = queueMap.remove(url);

    //check if view queue already contains first view 
    if (ivs == null || !ivs.containsKey(firstView)) {
        checkCb(this, url, firstView, bm, status);
    }//www.  j  av  a  2 s  .c  o m

    if (ivs != null) {

        Set<ImageView> set = ivs.keySet();

        for (ImageView view : set) {
            BitmapAjaxCallback cb = ivs.get(view);
            cb.status = status;
            checkCb(cb, url, view, bm, status);
        }

    }

}

From source file:org.apache.axis.handlers.soap.SOAPService.java

/** 
 * Add this passed in Session to this Service's list of sessions
 *///from  w  w w .ja  v  a2 s .c o m
public void addSession(Session session) {
    WeakHashMap map = (WeakHashMap) sessions.get(this.getName());
    if (map == null) {
        map = new WeakHashMap();
        sessions.put(this.getName(), map);
    }
    if (!map.containsKey(session))
        map.put(session, null);
}