base/common/src/main/com/thesett/common/util/TimeoutMap.java
public Object get(Object key)
    {
        // Synchronize on the cache to ensure its integrity in a multi-threaded environment.
        synchronized (cache)
        {
            // Try to extract the matching element as an ElementMonitor,
            ElementMonitor monitor = (ElementMonitor) cache.get(key);

            // If the element is not null then return its value, else null.
            // Also upgrade the timestamp of the matching element to the present to show that it has been recently
            // accessed.
            if (monitor != null)
            {
                // Upgrade the timestamp.
                long t = System.currentTimeMillis();
                monitor.lastTouched = t;

                // Return the element.
                return monitor.element;
            }
            else
            {
                return null;
            }
        }
    }
public Object get(Object key)
    {
        // Synchronize on the cache to ensure its integrity in a multi-threaded environment.
        synchronized (cache)
        {
            // Try to extract the matching element as an ElementMonitor,
            ElementMonitor monitor = (ElementMonitor) cache.get(key);

            // If the element is not null then return its value, else null.
            // Also upgrade the timestamp of the matching element to the present to show that it has been recently
            // accessed.
            if (monitor != null)
            {
                // Upgrade the timestamp.
                long t = System.currentTimeMillis();
                monitor.lastTouched = t;

                // Return the element.
                return monitor.element;
            }
            else
            {
                return null;
            }
        }
    }
public Object get ( Object key ) { // Synchronize on the cache to ensure its integrity in a multi-threaded environment. synchronized ( cache ) { // Try to extract the matching element as an ElementMonitor, ElementMonitor monitor = ( ElementMonitor ) cache . get ( key ) ; // If the element is not null then return its value, else null. // Also upgrade the timestamp of the matching element to the present to show that it has been recently // accessed. if ( monitor != null ) { // Upgrade the timestamp. long t = System . currentTimeMillis ( ) ; monitor . lastTouched = t ; // Return the element. return monitor . element ; } else { return null ; } } }
Returns the value to which this map maps the specified key. Returns <tt>null</tt> if the map contains no mapping
for this key. A return value of <tt>null</tt> does not <i>necessarily</i> indicate that the map contains no
mapping for the key; it's also possible that the map explicitly maps the key to <tt>null</tt>. The <tt>
containsKey</tt> operation may be used to distinguish these two cases.

<p>More formally, if this map contains a mapping from a key <tt>k</tt> to a value <tt>v</tt> such that <tt>
(key==null ? k==null : key.equals(k))</tt>, then this method returns <tt>v</tt>; otherwise it returns <tt>
null</tt>. (There can be at most one such mapping.)

@param  key Key whose associated value is to be returned.

@return The value to which this map maps the specified key, or <tt>null</tt> if the map contains no mapping for
this key.

@throws ClassCastException   If the key is of an inappropriate type for this map (optional).
@throws NullPointerException If the key is <tt>null</tt> and this map does not permit <tt>null</tt> keys
(optional).

@see    #containsKey(Object)
Returns the value to which this map maps the specified key . Returns <tt > null< / tt > if the map contains no mapping for this key . A return value of <tt > null< / tt > does not <i > necessarily< / i > indicate that the map contains no mapping for the key ; it s also possible that the map explicitly maps the key to <tt > null< / tt > . The <tt > containsKey< / tt > operation may be used to distinguish these two cases .