/** * Set our entry's value and write through to the map. The * value to return is somewhat arbitrary here. Since a * WriteThroughEntry does not necessarily track asynchronous * changes, the most recent "previous" value could be * different from what we return (or could even have been * removed in which case the put will re-establish). We do not * and cannot guarantee more. */ public Object setValue(Object value) { if (value == null) throw new NullPointerException(); Object v = super.setValue(value); ConcurrentHashMap.this.put(getKey(), value); return v; } }
/** * Set our entry's value and write through to the map. The * value to return is somewhat arbitrary here. Since a * WriteThroughEntry does not necessarily track asynchronous * changes, the most recent "previous" value could be * different from what we return (or could even have been * removed in which case the put will re-establish). We do not * and cannot guarantee more. */ public Object setValue(Object value) { if (value == null) throw new NullPointerException(); Object v = super.setValue(value); ConcurrentHashMap.this.put(getKey(), value); return v; } }
/** * Set our entry's value and write through to the map. The * value to return is somewhat arbitrary here. Since a * WriteThroughEntry does not necessarily track asynchronous * changes, the most recent "previous" value could be * different from what we return (or could even have been * removed in which case the put will re-establish). We do not * and cannot guarantee more. */ public Object setValue(Object value) { if (value == null) throw new NullPointerException(); Object v = super.setValue(value); ConcurrentHashMap.this.put(getKey(), value); return v; } }