Merge addWithoutResize and rehashIfNeeded into one function.

It will be more safety to add an element, users do not need to  the function rehashIfNeeded() after addWithoutResize().