1624 |
|
* Removes all of the mappings from this map. |
1625 |
|
*/ |
1626 |
|
public void clear() { |
1627 |
< |
initialize(); |
1627 |
> |
for (;;) { |
1628 |
> |
Node<K,V> b, n; |
1629 |
> |
HeadIndex<K,V> h = head, d = (HeadIndex<K,V>)h.down; |
1630 |
> |
if (d != null) |
1631 |
> |
casHead(h, d); // remove levels |
1632 |
> |
else if ((b = h.node) != null && (n = b.next) != null) { |
1633 |
> |
Node<K,V> f = n.next; // remove values |
1634 |
> |
if (n == b.next) { |
1635 |
> |
Object v = n.value; |
1636 |
> |
if (v == null) |
1637 |
> |
n.helpDelete(b, f); |
1638 |
> |
else if (n.casValue(v, null) && n.appendMarker(f)) |
1639 |
> |
b.casNext(n, f); |
1640 |
> |
} |
1641 |
> |
} |
1642 |
> |
else |
1643 |
> |
break; |
1644 |
> |
} |
1645 |
|
} |
1646 |
|
|
1647 |
|
/** |