Solved

Java vector or array for string sorting

Posted on 2009-04-14
3
289 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now