Chnaged hash method for dictionary to hash cod + mad
This commit is contained in:
@@ -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+= "]";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user