Questions tagged [hashmap]
A data structure that uses a hash function to map identifying values, known as keys, to their associated values
hashmap
15,293
questions
0
votes
1
answer
41
views
What does an "entry" refer to in a Hashmap? Does it mean the quantity of filled buckets, or the overall quantity of keys?
I am following along with The Odin Project.
They state "The product of these two numbers (load factor and current capacity) gives us a number, and we know it’s time to grow when there are more ...
6
votes
1
answer
66
views
Need to understand map.get() method after Overriding hashCode and equals in Java
I have overridden the hashCode and equals methods as below, and I want to understand the implementation of Map get method.
public class Student{
String name;
Student(String s){
this....
0
votes
1
answer
63
views
Is ConcurrentHashMap needed, if I will only use get() method
I created an enum that includes 4 address formats. I know which country uses which format, and I'm trying to create a HashMap that will include countries as key, and formats as value. I want to get ...
1
vote
1
answer
95
views
Java List.of() as key in HashMap?
I know that in general, you should only use immutable objects as a key to a hashmap since if their address or their contents change, then the hash breaks. This is one of the reasons why a normal List ...
-2
votes
0
answers
38
views
How to know if element exists in HashMap [duplicate]
I have a map that is already populated, when calling map.get(key), if element against that key exists it returns its corresponding value which can be null and if not then still null. I want to know ...
-2
votes
1
answer
54
views
My multi threaded rayon Rust loop can't outperform my Signlethreaded loop
I've been creating a function that is supposed to a BigUint into the base 1048576. I've been paralyzed by a problem I'm not quite sure how to solve.
I originally made a single threaded varient but on ...
-2
votes
0
answers
62
views
Insert, find, update, and remove operations in HashMap [closed]
I am not sure what it wrong with my code. I kept getting error 1.1.9. =
I tried to check which lines were the cause it looks like lines 29, 52 and 120 have been the cause. It is saying parts of my ...
-2
votes
1
answer
64
views
My HashMap which contains new Doctor keeps overriding the previous one whenever I use addDoctor method
I use HashMap to store String followed by object Doctor, where the String is the copy of code in Doctor.
At first I thought it just some problem with checking condition and throw Exception but it not.
...
-1
votes
0
answers
54
views
Deadlock Issue with Memory Management in Java Program [closed]
I have a Java program that utilizes a HashMap, and there seems to be an issue with memory not being released when items are deleted from it. The garbage collector (GC) doesn't seem to run until the ...
-3
votes
0
answers
45
views
I'm confused about how HashMap and HashSet manage Multiple Keys or Values [duplicate]
I have very low understanding in hashMap and hashSet internal functioning and i need help!
So:
HashMap:
I can't put two objects with same keys, So when i have object A and B, the first one has,
for ...
-2
votes
1
answer
66
views
HashMap Key and Values, does i need to define equals and hashCode() all time? [duplicate]
I have a question about HashMap<Key,Values>.
Let's imagine this scenario:
I have a Person class:
Person a=new Person(int id, String fullName, int age)
I didn't define the equals and hashCode ...
6
votes
1
answer
178
views
Fastest key value grouping
Given an array of <key, value> pairs, what is the state-of-the-art approach to group the keys together by values?
#include <vector>
#include <random>
#include <execution>
#...
2
votes
1
answer
43
views
check whether new array contains the special character using hashmap
New to JavaScript Programming. So I will make this short for you to read so you dont waste your time.
Trying to get a check to work for a password generator.
const chars = ["a", "b"...
0
votes
2
answers
64
views
Convert array to a hashmap during Jackson mapping, with each entry key being the entrie's id field
This is the JSON I'm working on:
{
"default": "ignore-me",
"catalog": [
{
"id": "object-1",
"name": &...
3
votes
4
answers
75
views
Rust HashMap supporting pointer stability to allow key referencing its value
In Rust, using a HashMap where the key is a &str that refers to a String member within its corresponding value is not directly possible. The following example illustrates the idea:
type PersonMap =...