Y
yzzzzz
Hi,
I want to store an int->V map (V is a class).
This map will contain about 10 to 15 values.
The integer key will vary from 1 to about 160.
I will be using up to 50 such maps at a time.
I am trying to optimize speed and memory usage (though speed is more
important).
1. I could use an ArrayList, but it would be a waste of space (about 150
of the values would be null). This is what I am doing at the moment
2. I could use a Map<Integer,V>. What kind of map? Hashmap? I didn't
think it was worth hashing Integers. Plus I don't like the idea of
boxing/unboxing all the time.
3. Is there a better way of doing this? A map whose keys are ints?
Thanks.
I want to store an int->V map (V is a class).
This map will contain about 10 to 15 values.
The integer key will vary from 1 to about 160.
I will be using up to 50 such maps at a time.
I am trying to optimize speed and memory usage (though speed is more
important).
1. I could use an ArrayList, but it would be a waste of space (about 150
of the values would be null). This is what I am doing at the moment
2. I could use a Map<Integer,V>. What kind of map? Hashmap? I didn't
think it was worth hashing Integers. Plus I don't like the idea of
boxing/unboxing all the time.
3. Is there a better way of doing this? A map whose keys are ints?
Thanks.