r/javahelp • • Mar 15 '20

Hashmap

What is the simplest hashmap you can code? I'm thinking of an int[] array with linkedlist at each index? Is there any other way? also please provide code, I'm stuggling to code one perfectly?

0 Upvotes

7 comments sorted by

View all comments

1

u/RhoOfFeh Mar 15 '20

I would take my cue from the standard library and create an object to represent a single entry in the Map. An array of these will serve pretty well I suppose. An ArrayList would simplify things but I'm not sure whether you are seeking to avoid the Collections related standards altogether.