All lists in Java support insertion order

List javadocs mentions lists are ordered. However, I do not see anything that determines the nature of the order. Can we rely on lists, for example. ArrayList and LinkedList support insertion order ?

I ask about an instance where we do not call setor sort.

+4
source share
1 answer

However, I do not see anything that determines the nature of the order.

Oddly enough, he mentioned in the second sentence of his documentation :

The user of this interface has precise control over where each item is inserted in the list.

List#set List#sort , List, List#add List#addAll, ( ); List ListIterator.

List , . , , .

+4

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


All Articles