Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Sorting the vectors

Posted on 2003-11-23
Medium Priority
253 Views
Hi

How can I sort the vectors?

Thanks and Regards,
0
Question by:lakkiprasanna
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 14

Expert Comment

ID: 9808677

http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20095494.html

0

LVL 14

Accepted Solution

sudhakar_koundinya earned 100 total points
ID: 9808686

// simple bubble sort.
for (int j=myDateVector.size()-1;j>=1;j--) {
for (int i=0;i<j;i++) {
Date d1=(Date) myDateVector.elementAt(i);
Date d2=(Date) myDateVector.elementAt(i+1);

if (d2.getTime()<d1.getTime()) {
myDateVector.setElementAt(d2, i);
myDateVector.setElementAt(d1, i+1);
}
} from http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_20095494.html
0

Author Comment

ID: 9808700
actually iam expecting for date sorter only

thanks sudhakar for giving other link also
0

## Featured Post

Question has a verified solution.

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

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
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 video teaches viewers about errors in exception handling.
###### Suggested Courses
Course of the Month11 days, 9 hours left to enroll