@Override @SuppressWarnings("unchecked") public void putAll(Map puts) { if ( puts.size() > 0 ) { initialize( true ); for ( Object o : puts.entrySet() ) { final Entry entry = (Entry) o; put( entry.getKey(), entry.getValue() ); } } }
@Override @SuppressWarnings("unchecked") public void clear() { if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! map.isEmpty() ) { dirty(); map.clear(); } } }
@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; }
@Override @SuppressWarnings("unchecked") public void putAll(Map<? extends K, ? extends V> puts) { if ( puts.size() > 0 ) { initialize( true ); for ( Entry<? extends K, ? extends V> entry : puts.entrySet() ) { put( entry.getKey(), entry.getValue() ); } } }
/** * @see java.util.Map#putAll(java.util.Map puts) */ public void putAll(Map puts) { if ( puts.size()>0 ) { initialize( true ); Iterator itr = puts.entrySet().iterator(); while ( itr.hasNext() ) { Map.Entry entry = ( Entry ) itr.next(); put( entry.getKey(), entry.getValue() ); } } }
/** * @see java.util.Map#putAll(java.util.Map puts) */ public void putAll(Map puts) { if ( puts.size()>0 ) { initialize( true ); Iterator itr = puts.entrySet().iterator(); while ( itr.hasNext() ) { Map.Entry entry = ( Entry ) itr.next(); put( entry.getKey(), entry.getValue() ); } } }
@Override @SuppressWarnings("unchecked") public void clear() { if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! map.isEmpty() ) { dirty(); map.clear(); } } }
/** * @see java.util.Map#clear() */ public void clear() { if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! map.isEmpty() ) { dirty(); map.clear(); } } }
/** * @see java.util.Map#clear() */ public void clear() { if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! map.isEmpty() ) { dirty(); map.clear(); } } }
/** * @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 ); }
@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; }
/** * @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; }