+ 2
Which Collection Class maintains insertion order in Java .
1) ArrayList 2) HashSet 3)LinkedSet 4) PriorityQeue
5 ответов
+ 1
1) ArrayList - yes
2) HashSet - no
3) LinkedSet - doesn't exist, but
LinkedHashSet - yes
4) PriorityQeue - doesn't exist,
PriorityQueue has natural order or by used Comparator
+ 2
Sanjay kumar Sahu,
For future posts please use the programming language in tags, so that the community has a more precice idea what your issue is.
+ 2
Lists in java maintains order in a way values inserted. While Sets ( also PriorityQueue) don't maintain order. So ArrayList maintains order but HashSet, LinkedHashSet, PriorityQueue don't maintains the order of elements..
+ 1
4?
+ 1
The way you are inserting the data , the same way it will print. Means Insertion order.