From cd76bd3d5a2020fa53507ce124abe42cc3959240 Mon Sep 17 00:00:00 2001 From: PhantomRex123 <78041469+PhantomRex123@users.noreply.github.com> Date: Thu, 4 Apr 2024 17:45:58 +0330 Subject: [PATCH] Create hashmap.md --- src/data_structures/hashmap.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/data_structures/hashmap.md diff --git a/src/data_structures/hashmap.md b/src/data_structures/hashmap.md new file mode 100644 index 0000000..b2d3680 --- /dev/null +++ b/src/data_structures/hashmap.md @@ -0,0 +1,20 @@ +### Hashmaps + +With arrays you have to store data in an ordered sequence identified with a indx. `Hashmaps` store data in a (key, pair) sequence that you can access by the index referring to another Object(indx is also an Object) + +```java +import java.util.HashMap; +HashMap Name = new HashMap(); +``` + +**Functions:** + +```java +map.put(identifier, value); +map.get(identifier); +map.remove(identifier); +map.clear(); // Deletes the whole map +map.size(); +``` + +Note: use `keyset()` to only get keys and `values()` to get specific Object values in loops