Java - collection with LinkedHashMap attributes

Is there a collection class that has LinkedHashMap quality of a predictable iteration order but is indexable at the same time? LinkedHashMap implements the get () method, which returns a value object, but the indexof () method is not available. I would like both.

Thanks.

+3
source share
2 answers

I have such a thing, Linked Tree Map is free and without restrictions on my site. It looks like what you want.

+1
source

A SortedMap (ConcurrentSkipListMap, TreeMap) has methods that return subframes of all keys> (or <) of the passed key. So,

index(key) == sortedMap.headMap(key).size();

.

0

Source: https://habr.com/ru/post/1715007/


All Articles