Is there any class in Java that contains an array of elements in order and is optimized for quick searches?
those. I need to get elements with both a numerical index (e.g. c Vector) and a hash (e.g. c HashMap).
LinkedHashMap does not match
I think that LinkedHashMapdoes not match, since it guarantees order, but does not allow quick access by index (position number). According to the description, in order to find a given position, you will need to go through the whole chain. This is what anyone Collectionwith an iterator can do.
EDIT 2
those. both search by key and by index should be fast, and not just a key.
source
share