Java vector or array for string sorting

Given vector or array to store strings, which one allows sorting?
Please advise how.
Who is Participating?
objectsConnect With a Mentor Commented:
both do. Vector is synchronized while ArrayList is not.
So use ArrayList where only single thread access, asi its faster

aman123_123Connect With a Mentor Commented:
I hope you are refering to ArrayList not array.
Both allow sorting. Sort method is provided in the utility Collections class.
As for arrays, Arrays class has the sort method.
isarasooConnect With a Mentor Commented:
i thinks if you have an array you you can use the static method sort of class a as follows

just a suggestion i havent tested it. so it might not work
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.