Perhaps all the data items stored in the three arrays could be put into a
single new class so that, by definition, all the data would be sorted
together.  At that point, you might not need three separate arrays.

If you need to sort the data in different ways, you can avoid making copies
of the List (to sort each one differently).  Declare a static field in the
class to indicate the sort method that you need at the moment, then read
that static field in the compareTo() method.  A user of that class that
needs to sort a certain way would set the static field (say, through a
sortMethodXXX() method you declare in the class) and call Collections.sort()
as Sergio had previously suggested.  

If you might be calling the sort() method in a multithreaded environment,
you'll have to take synchronization issues into account (to make certain
that each thread uses the static field value needed to implement the sort
method that thread needs).  The suggestion above should work if you declare
the sortMethodXXX() method as synchronized, but you'll need to test that
carefully to make certain that one thread does not corrupt or delay the
results expected within another thread.

Hope this helps.

Cheers,
Gordon Smith

-----Original Message-----
From: password password [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 27, 2006 10:57 AM
To: Tomcat Users List; [EMAIL PROTECTED]
Subject: Re: sort an array

Hi, 
     
     Arrays.sort(astrName); 



  I can not use the sort method because I have the arrays have an relation.
I mean, the first element of astrName have relation with first element of
adblBackground1, adblBackground2, adblItensity1 and adblItensity2. 
  Then I can sort each array independently, if I sort an element of astrName
I have to sort the rest of arrays. 
  Can you tell me a way to do this? 
  Thanks. 



                
---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to