Example usage for java.lang.ref SoftReference get

List of usage examples for java.lang.ref SoftReference get

Introduction

In this page you can find the example usage for java.lang.ref SoftReference get.

Prototype

public T get() 

Source Link

Document

Returns this reference object's referent.

Usage

From source file:org.grails.buffer.StreamCharBuffer.java

protected void notifyBufferChange() {
    markBufferChanged();//from   www . j av a 2s  .c  o  m

    if (!notifyParentBuffersEnabled)
        return;

    if (parentBuffers == null) {
        return;
    }

    for (Iterator<SoftReference<StreamCharBufferKey>> i = parentBuffers.iterator(); i.hasNext();) {
        SoftReference<StreamCharBufferKey> ref = i.next();
        final StreamCharBuffer.StreamCharBufferKey parentKey = ref.get();
        boolean removeIt = true;
        if (parentKey != null) {
            StreamCharBuffer parent = parentKey.getBuffer();
            removeIt = !parent.bufferChanged(this);
        }
        if (removeIt) {
            i.remove();
        }
    }
}

From source file:com.codename1.impl.android.AndroidImplementation.java

/**
 * @inheritDoc//from ww  w.  ja v a  2s.c o m
 */
public Object extractHardRef(Object o) {
    SoftReference w = (SoftReference) o;
    if (w != null) {
        return w.get();
    }
    return null;
}