Chnaged hash method for dictionary to hash cod + mad

This commit is contained in:
2014-05-13 10:38:13 +02:00
parent 5099e8d1af
commit 867a7c1a53
7 changed files with 107 additions and 81 deletions

View File

@@ -6,6 +6,7 @@ import position.PositionList;
import priorityqueue.Entry;
import java.security.InvalidKeyException;
import java.util.Iterator;
/**
* A hash table data structure that uses linear probing to handle
@@ -181,5 +182,27 @@ public class HashTableMap<K,V> implements Map<K,V> {
return values;
}
}
public String toString() {
Iterator<Entry<K,V>> it = entries().iterator();
String to_return = "";
to_return = to_return + "[";
for (;it.hasNext();){
Entry<K,V> t = it.next();
if (it.hasNext()) {
to_return+=(t.toString() + " , ");
} else {
to_return+=(t.toString());
}
}
return to_return+= "]";
}
}