Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [hashmap]

A data structure that uses a hash function to map identifying values, known as keys, to their associated values

hashmap
0 votes
1 answer
32 views

Using a str variable as a key for a map always returns null

I am trying to use a Map without success. I have whittled it down to a bare-bones case: I create a Map with four entries: ("fruit", 25) ("veg", 30) ("baked", 35) ("...
tbbrightman's user avatar
0 votes
0 answers
47 views

How can I estimate the difference in performance of a HashMap lookup vs List iteration in Kotlin?

I am working on an application that needs to map pdf documents to corresponding json data files (see: Kotlin data structure for efficient lookup of nested data for more details). In trying to ...
pbuchheit's user avatar
  • 1,663
-2 votes
0 answers
48 views

Compare two maps where the values are class objects [closed]

I'm trying to compare two hashmaps where the values are class objects. I know the .equals() for the class can be overridden so it would compare the values rather than instances but what if the class ...
Kel243's user avatar
  • 23
0 votes
1 answer
21 views

How can I make hashing algorithm for code snippets?

I would like to make an algorithm, which can detect code snippets when iterating through source codes, based on some hashing algorithms. So for example, here is that short code snippet from a fragment ...
Fox1942's user avatar
  • 298
0 votes
0 answers
5 views

Grouping 2D data using Python

class Point: def __init__(self, x=None, y=None): self.x = x self.y = y self.xy_list = [x, y] def __eq__(self, other): if isinstance(other, Point): ...
Donnie's user avatar
  • 1
0 votes
2 answers
39 views

How to filter and clone HashMap in Rust? [duplicate]

I've got a simple task: filter existing HashMap and clone it into a new variable in Rust. The code I've tried: let numbers: HashMap<u32, u32> = HashMap::from([ (1, 10), (2, 20), (3, ...
Alexander's user avatar
  • 621
0 votes
1 answer
38 views

Get HashMap value from object [duplicate]

I have a json like this { "data": { "category": { "name_en": "Trend", "style": "normal" }, "items"...
SugarSecret's user avatar
0 votes
1 answer
42 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 ...
HailVelkekia's user avatar
5 votes
1 answer
142 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....
Ayush's user avatar
  • 274
0 votes
1 answer
67 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 ...
Hacı Efendi's user avatar
1 vote
1 answer
98 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 ...
CodingMike's user avatar
-3 votes
0 answers
39 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 ...
Muhammad Haris's user avatar
-2 votes
1 answer
55 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 ...
Thetrue kingofwaffles's user avatar
-2 votes
1 answer
66 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. ...
Duong Nguyen's user avatar
-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 ...
el moutawakil's user avatar

15 30 50 per page
1
2 3 4 5
1020