ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jdk8/java/util/concurrent/ConcurrentSkipListMap.java
(Generate patch)

Comparing jsr166/src/jdk8/java/util/concurrent/ConcurrentSkipListMap.java (file contents):
Revision 1.4 by jsr166, Fri Jun 17 19:51:09 2016 UTC vs.
Revision 1.5 by jsr166, Sun Sep 25 18:30:12 2016 UTC

# Line 1624 | Line 1624 | public class ConcurrentSkipListMap<K,V>
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      /**

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines