Solved

Java vector or array for string sorting

Posted on 2009-04-14
3
292 Views
Last Modified: 2013-11-23
Given vector or array to store strings, which one allows sorting?
Please advise how.
Thanks.
0
Comment
Question by:ksfok
3 Comments
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 24144706
both do. Vector is synchronized while ArrayList is not.
So use ArrayList where only single thread access, asi its faster

0
 
LVL 4

Assisted Solution

by:aman123_123
aman123_123 earned 200 total points
ID: 24144713
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
 
LVL 1

Assisted Solution

by:isarasoo
isarasoo earned 100 total points
ID: 24147144
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

Featured Post

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question