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 |
/** |
/** |
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 |
} |
} |