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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.47 by dl, Thu Apr 15 14:49:13 2004 UTC vs.
Revision 1.48 by dl, Wed Jun 2 23:49:06 2004 UTC

# Line 73 | Line 73 | import java.io.ObjectOutputStream;
73   * @param <V> the type of mapped values
74   */
75   public class ConcurrentHashMap<K, V> extends AbstractMap<K, V>
76 <        implements ConcurrentMap<K, V>, Cloneable, Serializable {
76 >        implements ConcurrentMap<K, V>, Serializable {
77      private static final long serialVersionUID = 7249069246763182397L;
78  
79      /*
# Line 987 | Line 987 | public class ConcurrentHashMap<K, V> ext
987              segments[i].clear();
988      }
989  
990
991    /**
992     * Returns a shallow copy of this
993     * <tt>ConcurrentHashMap</tt> instance: the keys and
994     * values themselves are not cloned.
995     *
996     * @return a shallow copy of this map.
997     */
998    public Object clone() {
999        // We cannot call super.clone, since it would share final
1000        // segments array, and there's no way to reassign finals.
1001
1002        float lf = segments[0].loadFactor;
1003        int segs = segments.length;
1004        int cap = (int)(size() / lf);
1005        if (cap < segs) cap = segs;
1006        ConcurrentHashMap<K,V> t = new ConcurrentHashMap<K,V>(cap, lf, segs);
1007        t.putAll(this);
1008        return t;
1009    }
1010
990      /**
991       * Returns a set view of the keys contained in this map.  The set is
992       * backed by the map, so changes to the map are reflected in the set, and

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines