Skip to content

Instantly share code, notes, and snippets.

View itsuncheng's full-sized avatar
:octocat:
AlwaysLearning

Raymond Cheng itsuncheng

:octocat:
AlwaysLearning
View GitHub Profile
@amadamala
amadamala / HashTable.java
Last active June 28, 2022 03:55
HashTable implementation in Java
public class HashTable {
private static int INITIAL_SIZE = 16;
private HashEntry[] entries = new HashEntry[INITIAL_SIZE];
public void put(String key, String value) {
int hash = getHash(key);
final HashEntry hashEntry = new HashEntry(key, value);
if(entries[hash] == null) {
entries[hash] = hashEntry;
}
// If there is already an entry at current hash