base/common/src/main/com/thesett/common/util/TimeoutMap.java
public Object put(Object key, Object value)
    {
        // Synchronize on the cache to ensure its integrity in a multi-threaded environment.
        synchronized (cache)
        {
            // Create a new ElementMonitor in the cache for the new element.
            // Timestamp the new element with the present time.
            long t = System.currentTimeMillis();

            // Extract the element value out of the replaced element monitor if any.
            ElementMonitor replaced = (ElementMonitor) cache.put(key, new ElementMonitor(value, t));

            if (replaced != null)
            {
                return replaced.element;
            }
            else
            {
                return null;
            }
        }
    }
public Object put(Object key, Object value)
    {
        // Synchronize on the cache to ensure its integrity in a multi-threaded environment.
        synchronized (cache)
        {
            // Create a new ElementMonitor in the cache for the new element.
            // Timestamp the new element with the present time.
            long t = System.currentTimeMillis();

            // Extract the element value out of the replaced element monitor if any.
            ElementMonitor replaced = (ElementMonitor) cache.put(key, new ElementMonitor(value, t));

            if (replaced != null)
            {
                return replaced.element;
            }
            else
            {
                return null;
            }
        }
    }
public Object put ( Object key , Object value ) { // Synchronize on the cache to ensure its integrity in a multi-threaded environment. synchronized ( cache ) { // Create a new ElementMonitor in the cache for the new element. // Timestamp the new element with the present time. long t = System . currentTimeMillis ( ) ; // Extract the element value out of the replaced element monitor if any. ElementMonitor replaced = ( ElementMonitor ) cache . put ( key , new ElementMonitor ( value , t ) ) ; if ( replaced != null ) { return replaced . element ; } else { return null ; } } }
Associates the specified value with the specified key in this map (optional operation). If the map previously
contained a mapping for this key, the old value is replaced by the specified value. (A map <tt>m</tt> is said to
contain a mapping for a key <tt>k</tt> if and only if {@link #containsKey(Object) m.containsKey(k)} would return
<tt>true</tt>.))

@param  key   Key with which the specified value is to be associated.
@param  value Value to be associated with the specified key.

@return Previous value associated with specified key, or <tt>null</tt> if there was no mapping for key. A <tt>
null</tt> return can also indicate that the map previously associated <tt>null</tt> with the specified
key, if the implementation supports <tt>null</tt> values.

@throws UnsupportedOperationException If the <tt>put</tt> operation is not supported by this map.
@throws ClassCastException            If the class of the specified key or value prevents it from being stored in
this map.
@throws IllegalArgumentException      If some aspect of this key or value prevents it from being stored in this
map.
@throws NullPointerException          If this map does not permit <tt>null</tt> keys or values, and the specified
key or value is <tt>null</tt>.
Associates the specified value with the specified key in this map ( optional operation ) . If the map previously contained a mapping for this key the old value is replaced by the specified value . ( A map <tt > m< / tt > is said to contain a mapping for a key <tt > k< / tt > if and only if { @link #containsKey ( Object ) m . containsKey ( k ) } would return <tt > true< / tt > . ))