/** * @see java.util.Hashtable#putAll(java.util.Map) */ @Override public synchronized void putAll(Map<? extends K,? extends V> t) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { t.entrySet().stream().forEach((newEntry) -> { this.put(newEntry.getKey(), newEntry.getValue()); }); }else{ this.getDelegate().putAll(t); } }
/** * @see java.util.Hashtable#putAll(java.util.Map) */ @Override public synchronized void putAll(Map<? extends K,? extends V> t) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { Iterator<? extends K> objects = t.keySet().iterator(); while (objects.hasNext()) { K key = objects.next(); this.put(key, t.get(key)); } }else{ this.getDelegate().putAll(t); } }
/** * @see java.util.Hashtable#putAll(java.util.Map) */ public synchronized void putAll(Map t) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { Iterator objects = t.keySet().iterator(); while (objects.hasNext()) { Object key = objects.next(); this.put(key, t.get(key)); } }else{ this.getDelegate().putAll(t); } }
@Override public synchronized boolean replace(K key, V oldValue, V newValue) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { Map<K, V> del = getDelegate(); if (del.containsKey(key) && Objects.equals(del.get(key), oldValue)) { put(key, newValue); return true; } return false; } return getDelegate().replace(key, oldValue, newValue); }
@Override public synchronized V compute(K key, BiFunction<? super K,? super V,? extends V> remappingFunction) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { V oldValue = get(key); V newValue = remappingFunction.apply(key, oldValue); if (oldValue != null ) { if (newValue != null) { put(key, newValue); return newValue; } remove(key); } else { if (newValue != null) { put(key, newValue); return newValue; } } return null; } return getDelegate().compute(key, remappingFunction); }
@Override public synchronized V replace(K key, V value) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { Map<K, V> del = getDelegate(); if (del.containsKey(key)) { return put(key, value); } return null; } return getDelegate().replace(key, value); }
@Override public synchronized V computeIfAbsent(K key, Function<? super K,? extends V> mappingFunction) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { V oldValue = get(key); if (oldValue == null) { V newValue = mappingFunction.apply(key); if (newValue != null) { put(key, newValue); } return newValue; } return oldValue; } return getDelegate().computeIfAbsent(key, mappingFunction); }
@Override public synchronized V merge(K key, V value, BiFunction<? super V,? super V,? extends V> remappingFunction) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { V oldValue = get(key); V newValue = (oldValue == null) ? value : remappingFunction.apply(oldValue, value); if (newValue == null) { remove(key); } else { put(key, newValue); } return newValue; } return getDelegate().merge(key, value, remappingFunction); }
@Override public synchronized V computeIfPresent(K key, BiFunction<? super K,? super V,? extends V> remappingFunction) { // Must trigger add events if tracked or uow. if (hasTrackedPropertyChangeListener()) { if (get(key) != null) { V oldValue = get(key); V newValue = remappingFunction.apply(key, oldValue); if (newValue != null) { put(key, newValue); return newValue; } remove(key); } return null; } return getDelegate().computeIfPresent(key, remappingFunction); }