rendered paste bodyto insert
int hash = newnode.key.hashCode();
int headernum = hash%num_of_headers;
hashnode curr = headers[headernum];
while (curr != null) {
if (curr.key.equals(key))
{
unitmap.unit myunit = curr.value;
curr.value = newnode.value;
return myunit;
}
curr = curr.link;
}
newnode.link = headers[headernum];
headers[headernum] = newnode;
return null;
to find
int hash = key.hashCode();
int headernum = hash&num_ofheaders;
hashnode curr = headers[headernum];
while (curr != null) {
if (curr.key.equals(key))
return curr.value;
curr = curr.link;
}
return null;