/[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.13 by ericb, Sun Sep 16 05:52:04 2001 UTC revision 1.14 by ericb, Tue Sep 18 03:25:11 2001 UTC
# Line 111  public class HashMap extends AbstractMap Line 111  public class HashMap extends AbstractMap
111      {      {
112        super(key, value);        super(key, value);
113      }      }
   
     Entry copy()  
     {  
       Entry e = new Entry(key, value);  
       if (next != null)  
         e.next = next.copy();  
       return e;  
     }  
114    }    }
115    
116    /**    /**
# Line 373  public class HashMap extends AbstractMap Line 365  public class HashMap extends AbstractMap
365      for (int i=0; i < buckets.length; i++)      for (int i=0; i < buckets.length; i++)
366        {        {
367          Entry e = buckets[i];          Entry e = buckets[i];
368          if (e != null)          Entry last = null;
369            copy.buckets[i] = e.copy();  
370            while (e != null)
371              {
372                if (last == null)
373                  {
374                    last = new Entry(e.key, e.value);
375                    copy.buckets[i] = last;
376                  }
377                else
378                  {
379                    last.next = new Entry(e.key, e.value);
380                    last = last.next;
381                  }
382                e = e.next;
383              }
384        }        }
385      return copy;      return copy;
386    }    }

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

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