This commit is contained in:
Joel Dice
2007-08-13 19:44:47 -06:00
parent ab3ca38580
commit d0e519d992
6 changed files with 28 additions and 21 deletions

View File

@ -53,8 +53,8 @@ public class HashMap<K, V> implements Map<K, V> {
for (Cell<K, V> c = array[i]; c != null; c = next) {
next = c.next();
int index = c.hashCode() & (capacity - 1);
c.setNext(array[index]);
array[index] = c;
c.setNext(newArray[index]);
newArray[index] = c;
}
}
}

View File

@ -127,8 +127,7 @@ public class LinkedList<T> implements List<T> {
public T removeFirst() {
if (front != null) {
T v = front.value;
front = front.next;
if (front != null) front.prev = null;
remove(front);
return v;
} else {
throw new NoSuchElementException();
@ -138,8 +137,7 @@ public class LinkedList<T> implements List<T> {
public T removeLast() {
if (rear != null) {
T v = rear.value;
rear = rear.prev;
if (rear != null) rear.next = null;
remove(rear);
return v;
} else {
throw new NoSuchElementException();