Represent List<E> as SortedMap<Integer,E> in Java?

66 Views Asked by At

Is there any wrapper in popular collection libraries, which implements wrapper for List<E> so that it can be accessed both with List<E> and SortedMap<Integer,E> interfaces?

The goal is to have indexes shifted on insert operation and autogenerated on add operation

1

There are 1 best solutions below

0
On

From what I know, both ArrayList and LinkedList provide these functionalities: appending (what you meant by autogeneration on add operation) is obviously possible and indexes are shifted when you do add(int index, E element).