Java vector or array for string sorting

Given vector or array to store strings, which one allows sorting?
Please advise how.
Thanks.
ksfokAsked:
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

0
 
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.
0
 
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
Array.sort(yourarray);

just a suggestion i havent tested it. so it might not work
0
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.