Skip to content

mpgarate/BasicHashMap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BasicHashMap

Hash map with linked lists to handle collisions, created as an exercise.

Generic types are supported.

Built using Java hashCode and java.util.LinkedList.

Usage

Instantiate

BasicHashMap<String, Integer> map = new BasicHashMap<String, Integer>();

Store a key.

String name = "Michael";
Integer age = 22;
map.add(name, age);

Get a key.

Integer age = map.get("Michael"); // 20

Remove a key.

map.remove("Michael");

Update a value.

map.add("Bill",22);
map.update("Bill", 45);
Integer value = hash.get("Bill") //45

Initialize a map with a custom array size.

// This is a map of size 1, so all elements
// will be in the linked list at index 0.
HashMap miniMap = new HashMap(1);

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors