/[classpath]/classpath/java/util/HashMap.java
ViewVC logotype

Diff of /classpath/java/util/HashMap.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.28.2.1 by tromey, Thu Aug 5 21:09:36 2004 UTC revision 1.28.2.2 by tromey, Sun Aug 15 07:59:52 2004 UTC
# Line 256  public class HashMap<K, V> extends Abstr Line 256  public class HashMap<K, V> extends Abstr
256    
257      if (initialCapacity == 0)      if (initialCapacity == 0)
258        initialCapacity = 1;        initialCapacity = 1;
259      buckets = new HashEntry[initialCapacity];      buckets = new HashEntry<K, V>[initialCapacity];
260      this.loadFactor = loadFactor;      this.loadFactor = loadFactor;
261      threshold = (int) (initialCapacity * loadFactor);      threshold = (int) (initialCapacity * loadFactor);
262    }    }
# Line 385  public class HashMap<K, V> extends Abstr Line 385  public class HashMap<K, V> extends Abstr
385        {        {
386          Map.Entry<? extends K, ? extends V> e = itr.next();          Map.Entry<? extends K, ? extends V> e = itr.next();
387          // Optimize in case the Entry is one of our own.          // Optimize in case the Entry is one of our own.
388          if (e instanceof AbstractMap.BasicMapEntry)          if (e instanceof AbstractMap.BasicMapEntry<K, V>)
389            {            {
390              AbstractMap.BasicMapEntry<? extends K, ? extends V> entry              AbstractMap.BasicMapEntry<? extends K, ? extends V> entry
391                = (AbstractMap.BasicMapEntry<? extends K, ? extends V>) e;                = (AbstractMap.BasicMapEntry<? extends K, ? extends V>) e;
# Line 456  public class HashMap<K, V> extends Abstr Line 456  public class HashMap<K, V> extends Abstr
456    {    {
457      for (int i = buckets.length - 1; i >= 0; i--)      for (int i = buckets.length - 1; i >= 0; i--)
458        {        {
459          HashEntry e = buckets[i];          HashEntry<K, V> e = buckets[i];
460          while (e != null)          while (e != null)
461            {            {
462              if (equals(value, e.value))              if (equals(value, e.value))
# Line 475  public class HashMap<K, V> extends Abstr Line 475  public class HashMap<K, V> extends Abstr
475     */     */
476    public Object clone()    public Object clone()
477    {    {
478      HashMap copy = null;      HashMap<K, V> copy = null;
479      try      try
480        {        {
481          copy = (HashMap) super.clone();          copy = (HashMap<K, V>) super.clone();
482        }        }
483      catch (CloneNotSupportedException x)      catch (CloneNotSupportedException x)
484        {        {
485          // This is impossible.          // This is impossible.
486        }        }
487      copy.buckets = new HashEntry[buckets.length];      copy.buckets = new HashEntry<K, V>[buckets.length];
488      copy.putAllInternal(this);      copy.putAllInternal(this);
489      // Clear the entry cache. AbstractMap.clone() does the others.      // Clear the entry cache. AbstractMap.clone() does the others.
490      copy.entries = null;      copy.entries = null;
# Line 660  public class HashMap<K, V> extends Abstr Line 660  public class HashMap<K, V> extends Abstr
660    // Package visible, for use in nested classes.    // Package visible, for use in nested classes.
661    final HashEntry<K, V> getEntry(Object o)    final HashEntry<K, V> getEntry(Object o)
662    {    {
663      if (! (o instanceof Map.Entry))      if (! (o instanceof Map.Entry<K, V>))
664        return null;        return null;
665      Map.Entry<K, V> me = (Map.Entry<K, V>) o;      Map.Entry<K, V> me = (Map.Entry<K, V>) o;
666      K key = me.getKey();      K key = me.getKey();

Legend:
Removed from v.1.28.2.1  
changed lines
  Added in v.1.28.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26