/** * {@inheritDoc} * * @throws ClassCastException if the specified key cannot be compared * with the keys currently in the map * @throws NullPointerException if any of the arguments are null */ public boolean replace(Object key, Object oldValue, Object newValue) { if (oldValue == null || newValue == null) throw new NullPointerException(); Comparable k = comparable(key); for (;;) { Node n = findNode(k); if (n == null) return false; Object v = n.value; if (v != null) { if (!oldValue.equals(v)) return false; if (n.casValue(v, newValue)) return true; } } }
/** * {@inheritDoc} * * @throws ClassCastException if the specified key cannot be compared * with the keys currently in the map * @throws NullPointerException if any of the arguments are null */ public boolean replace(Object key, Object oldValue, Object newValue) { if (oldValue == null || newValue == null) throw new NullPointerException(); Comparable k = comparable(key); for (;;) { Node n = findNode(k); if (n == null) return false; Object v = n.value; if (v != null) { if (!oldValue.equals(v)) return false; if (n.casValue(v, newValue)) return true; } } }
/** * {@inheritDoc} * * @return the previous value associated with the specified key, * or <tt>null</tt> if there was no mapping for the key * @throws ClassCastException if the specified key cannot be compared * with the keys currently in the map * @throws NullPointerException if the specified key or value is null */ public Object replace(Object key, Object value) { if (value == null) throw new NullPointerException(); Comparable k = comparable(key); for (;;) { Node n = findNode(k); if (n == null) return null; Object v = n.value; if (v != null && n.casValue(v, value)) return v; } }
/** * {@inheritDoc} * * @throws ClassCastException if the specified key cannot be compared * with the keys currently in the map * @throws NullPointerException if any of the arguments are null */ public boolean replace(Object key, Object oldValue, Object newValue) { if (oldValue == null || newValue == null) throw new NullPointerException(); Comparable k = comparable(key); for (;;) { Node n = findNode(k); if (n == null) return false; Object v = n.value; if (v != null) { if (!oldValue.equals(v)) return false; if (n.casValue(v, newValue)) return true; } } }
/** * {@inheritDoc} * * @return the previous value associated with the specified key, * or <tt>null</tt> if there was no mapping for the key * @throws ClassCastException if the specified key cannot be compared * with the keys currently in the map * @throws NullPointerException if the specified key or value is null */ public Object replace(Object key, Object value) { if (value == null) throw new NullPointerException(); Comparable k = comparable(key); for (;;) { Node n = findNode(k); if (n == null) return null; Object v = n.value; if (v != null && n.casValue(v, value)) return v; } }
/** * {@inheritDoc} * * @return the previous value associated with the specified key, * or <tt>null</tt> if there was no mapping for the key * @throws ClassCastException if the specified key cannot be compared * with the keys currently in the map * @throws NullPointerException if the specified key or value is null */ public Object replace(Object key, Object value) { if (value == null) throw new NullPointerException(); Comparable k = comparable(key); for (;;) { Node n = findNode(k); if (n == null) return null; Object v = n.value; if (v != null && n.casValue(v, value)) return v; } }
Comparable key = comparable(okey); Node bound = null; Index q = head;
Comparable key = comparable(okey); Node bound = null; Index q = head;
Comparable key = comparable(kkey); for (;;) { Node b = findPredecessor(key);
Comparable key = comparable(kkey); for (;;) { Node b = findPredecessor(key);
Comparable key = comparable(kkey); for (;;) { Node b = findPredecessor(key);
Comparable key = comparable(idx.node.key); if (key == null) throw new NullPointerException();
Comparable key = comparable(idx.node.key); if (key == null) throw new NullPointerException();
Comparable key = comparable(okey); for (;;) { Node b = findPredecessor(key);
Comparable key = comparable(kkey); for (;;) { Node b = findPredecessor(key);
Comparable key = comparable(kkey); for (;;) { Node b = findPredecessor(key);
Comparable key = comparable(kkey); for (;;) { Node b = findPredecessor(key);
break; Object key = n.key; Comparable ck = comparable(key); if (!n.appendMarker(f) || !b.casNext(n, f))
break; Object key = n.key; Comparable ck = comparable(key); if (!n.appendMarker(f) || !b.casNext(n, f))
break; Object key = n.key; Comparable ck = comparable(key); if (!n.appendMarker(f) || !b.casNext(n, f))