Solved

Sorting the vectors

Posted on 2003-11-23
3
251 Views
Last Modified: 2010-03-31
Hi

How can I sort the vectors?

Thanks and Regards,
0
Comment
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
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9808677
read answers from my previous link (I have given answer there already)

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

0
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 25 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

by:lakkiprasanna
ID: 9808700
actually iam expecting for date sorter only

thanks sudhakar for giving other link also
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet example 11 77
jsp insert to database example 2 91
Html Table Looping (part 2) 5 42
ArrayList Adding/settign data 3 38
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

710 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