2,301 questions
0
votes
0
answers
64
views
Jackson (de)serialization with redisTemplate
A user has roles, and the serialized version that is stored in Redis is:
"{\"@class\":\"package.User\",\"id\":null,\"email\":\"[email protected]\&...
2
votes
2
answers
93
views
Creating an iterator over the `OccupiedEntry`s of a `HashSet` in Rust
Edit
I'm realizing that since Entrys own mutable borrows on their parent HashSets, it is impossible for multiple Entrys in a single HashSet to exist simultaneously. Therefore, Entrys will probably not ...
0
votes
2
answers
74
views
what is the maximum length possible of a hashset in python?
m = set()
for i in range(10**7):
m.add(i)
print(999999 in m)
above code runs fast (excluding the for loop inserting elements to hash set which takes a while)
what is the maximum length ...
0
votes
1
answer
65
views
How to create a set order for a HashSet (Java 24, IntelliJ Community) [duplicate]
I have been working on a simple clicker game, and I am using HashSet to store the list of achievements, and they aren't showing up in order. I understand that HashSet does not work like this, but ...
0
votes
0
answers
39
views
`HashSet` does not respect custom `Hash` implementation? [duplicate]
I’m trying to implement a "Storage" kind of structure: We have items in specific amounts but that amount may be composed of smaller "pile" of different units (they can also differ ...
0
votes
1
answer
222
views
Maximize efficiency for this LeetCode style problem [duplicate]
I found this LeetCode style problem in a previous assignment for my university.
Assume you have an online clothing store and you have products which come in variable sizes. Some products come in the ...
-1
votes
1
answer
83
views
How many pointers does java LinkedHashMap/Set Entry object have
In Java HashSet, when a collision occurs, the HashMap stores multiple entries in the same bucket using a linked list.
Then in the case of LinkedHashSet, LinkedHashMap will have a pointer to the next ...
0
votes
0
answers
16
views
How can I insert hashmap values only into Treeset or HashSet
This is my main class:
public class Main {
public static void main(String[] args) throws BookNotFoundException {
// TODO Auto-generated method stub
//Library library = new Library();
...
0
votes
1
answer
164
views
How can the accuracy of a Bloom filter be improved by introducing other data structures?
Suppose I have a very large dataset (for example, 1 billion keys), and I want to determine if a particular key is in this dataset. In this case, a Bloom filter is a good choice (with a time complexity ...
0
votes
1
answer
88
views
Is RefCell::as_ptr guaranteed to stay the same for a given RefCell?
I am looking for a way to impl Hash for MyStruct where MyStruct contains `Rc<RefCell> (yes, it's a linked list of a sort).
This answer suggests std::ptr::hash(self.next.as_ref()), but I have ...
0
votes
0
answers
78
views
how to solve borrowing problem for HashSet
I'm making a tokenizer and have encountered some difficulties.
To better understand the problem, I’ll briefly describe the components of the tokenizer:
Token. There are 3 types - Constant (fixed, ...
0
votes
1
answer
91
views
A hash function that maintains mathematical equality (especially for sets)
I'm working on a little math-based programming language (written in Rust) that uses sets instead of types. In it, a variable or value belongs to a set of values (eg. x : {1, 2, 3} or msg : Str). The ...
0
votes
1
answer
259
views
Does EFCore Where( ... set.Contains(...)) care whether Set is List or HashSet?
Suppose I an using EFCore to query a SQL DB, and I write:
myTableDbSet.Where(entity => filterSet.Contains(entity.Id))
Then does it make any difference (e.g. to performance) what the concrete type ...
0
votes
2
answers
111
views
What is the time complexity of populating a HashSet with n elements?
I was working on the Leetcode problem "Reverse Vowels of a String."
Here is my first solution:
class Solution {
public String reverseVowels(String s) {
String vowels = "...
1
vote
1
answer
101
views
Obtaining a Vec<X> from a &HashSet<X> [closed]
Assume I have some function do_stuff that takes a &HashSet<X> and wants to collect the items into a Vec<X> by copying all the elements. What is the canonical way to do that? I have ...