@Override public Object get(Object key) { final Object result = readElementByIndex( key ); return result == UNKNOWN ? map.get( key ) : result; }
@Override @SuppressWarnings("unchecked") public Object remove(Object key) { if ( isPutQueueEnabled() ) { final Object old = readElementByIndex( key ); if ( old != UNKNOWN ) { elementRemoved = true; queueOperation( new Remove( key, old ) ); return old; } } // TODO : safe to interpret "map.remove(key) == null" as non-dirty? initialize( true ); if ( map.containsKey( key ) ) { elementRemoved = true; dirty(); } return map.remove( key ); }
@Override @SuppressWarnings("unchecked") public Object put(Object key, Object value) { if ( isPutQueueEnabled() ) { final Object old = readElementByIndex( key ); if ( old != UNKNOWN ) { queueOperation( new Put( key, value, old ) ); return old; } } initialize( true ); final Object old = map.put( key, value ); // would be better to use the element-type to determine // whether the old and the new are equal here; the problem being // we do not necessarily have access to the element type in all // cases if ( value != old ) { dirty(); } return old; }
/** * @see java.util.Map#get(Object) */ public Object get(Object key) { Object result = readElementByIndex(key); return result==UNKNOWN ? map.get(key) : result; }
/** * @see java.util.Map#get(Object) */ public Object get(Object key) { Object result = readElementByIndex(key); return result==UNKNOWN ? map.get(key) : result; }
@Override public V get(Object key) { final V result = readElementByIndex( key ); return result == UNKNOWN ? map.get( key ) : result; }
/** * @see java.util.Map#remove(Object) */ public Object remove(Object key) { if ( isPutQueueEnabled() ) { Object old = readElementByIndex( key ); if ( old != UNKNOWN ) { queueOperation( new Remove( key, old ) ); return old; } } // TODO : safe to interpret "map.remove(key) == null" as non-dirty? initialize( true ); if ( map.containsKey( key ) ) { dirty(); } return map.remove( key ); }
/** * @see java.util.Map#remove(Object) */ public Object remove(Object key) { if ( isPutQueueEnabled() ) { Object old = readElementByIndex( key ); if ( old != UNKNOWN ) { queueOperation( new Remove( key, old ) ); return old; } } // TODO : safe to interpret "map.remove(key) == null" as non-dirty? initialize( true ); if ( map.containsKey( key ) ) { dirty(); } return map.remove( key ); }
@Override @SuppressWarnings("unchecked") public V remove(Object key) { if ( isPutQueueEnabled() ) { final V old = readElementByIndex( key ); if ( old != UNKNOWN ) { elementRemoved = true; queueOperation( new Remove( (K) key, old ) ); return old; } } // TODO : safe to interpret "map.remove(key) == null" as non-dirty? initialize( true ); if ( map.containsKey( key ) ) { elementRemoved = true; dirty(); } return map.remove( key ); }
/** * @see java.util.Map#put(Object, Object) */ public Object put(Object key, Object value) { if ( isPutQueueEnabled() ) { Object old = readElementByIndex( key ); if ( old != UNKNOWN ) { queueOperation( new Put( key, value, old ) ); return old; } } initialize( true ); Object old = map.put( key, value ); // would be better to use the element-type to determine // whether the old and the new are equal here; the problem being // we do not necessarily have access to the element type in all // cases if ( value != old ) { dirty(); } return old; }
@Override @SuppressWarnings("unchecked") public V put(K key, V value) { if ( isPutQueueEnabled() ) { final V old = readElementByIndex( key ); if ( old != UNKNOWN ) { queueOperation( new Put( key, value, old ) ); return old; } } initialize( true ); final V old = map.put( key, value ); // would be better to use the element-type to determine // whether the old and the new are equal here; the problem being // we do not necessarily have access to the element type in all // cases if ( value != old ) { dirty(); } return old; }
/** * @see java.util.Map#put(Object, Object) */ public Object put(Object key, Object value) { if ( isPutQueueEnabled() ) { Object old = readElementByIndex( key ); if ( old != UNKNOWN ) { queueOperation( new Put( key, value, old ) ); return old; } } initialize( true ); Object old = map.put( key, value ); // would be better to use the element-type to determine // whether the old and the new are equal here; the problem being // we do not necessarily have access to the element type in all // cases if ( value != old ) { dirty(); } return old; }