Java Code Examples for java.util.WeakHashMap.get()

The following are Jave code examples for showing how to use get() of the java.util.WeakHashMap class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: openjdk-jdk10   File: SunToolkit.java   Source Code and License Vote up 5 votes
public synchronized long getWindowDeactivationTime(Window w) {
    AppContext ctx = getAppContext(w);
    if (ctx == null) {
        return -1;
    }
    @SuppressWarnings("unchecked")
    WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
    if (map == null) {
        return -1;
    }
    Long time = map.get(w);
    return time == null ? -1 : time;
}
 
Example 2
Project: starcor.xul   File: XulUtils.java   Source Code and License Vote up 5 votes
private static void _doSaveInfo(WeakHashMap<Canvas, ArrayList<CanvasSaveInfo>> stack, CanvasSaveInfo info) {
	if (stack != null) {
		ArrayList<CanvasSaveInfo> canvasSaveInfos = stack.get(info.canvas);
		if (canvasSaveInfos == null) {
			canvasSaveInfos = new ArrayList<CanvasSaveInfo>();
			stack.put(info.canvas, canvasSaveInfos);
		}
		canvasSaveInfos.add(info);
	}
}