Building an efficient hash table in Java