> -----Original Message----- > From: Alex Karasulu [mailto:[EMAIL PROTECTED] ... > Now the arrays would look like so after these operations are performed: > > Keys Indices Object Values > ------ ----- ----- > | | | | | +-|-----> "Cat" > ------ ----- ----- > |2048| | 3 | | +-|-----> "Dog" > ------ ----- ----- > | 94 | | 2 | | | a hole (null) > ------ ----- ----- > | 23 | | 0 | | +-|-----> "Rat" > ------ ----- ----- >
This is exactly what I was thinking of. In addition, I was considering the "Keys" to be always sorted, so a binary search (with e.g. java.util.Arrays.binarySearch) could be used to lookup the actual index to the Object array. But more questions raise: 1. How much more time it takes to sort after every modification (compared to standard HashMap modification)? 2. How much time does the lookup take (compared to standard HashMap lookup)? Some hashing needed additionally (don't know anything about that)? I was thinking of doing some tests to investigate the actual advantage of something like this, but I don't know when I have time. And as I mentioned, there are LGPL:ed solutions available (should be tested, too), but if this kind of stuff is really more efficient and fast than using standard Map:s then it would be good to find that in e.g. commons-primitives. I don't need an int-keyed-map now, but probably would some day. - Tatu V. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
