Ali,
If you want the items to be in a specific order then you need to store them
in a Collection that preserves the order. The HashMap or any other Map for
that matter that you are using WILL NOT preserve the order. You need to
use an ArrayList instead.
InvoiceLineItems needs to be stored in an ArrayList.
-Richard
At 10:34 PM 9/23/01 -0400, you wrote:
>richard- i appreciate the input. i'd expect it to give back in the natural
>order, the order in which i put my items. however, something else is going
>on apparently. --a
>
>-----Original Message-----
>From: Richard Yee [mailto:[EMAIL PROTECTED]]
>Sent: Sunday, September 23, 2001 3:47 PM
>To: [EMAIL PROTECTED]
>Subject: Re: Postmortem (iterate, wrap, hashtable, nested)
>
>
>Ali,
>You are getting the InvoiceLineItems out of order b/c you are storing them
>in a Map or Hashtable. These collections do not preserve the order of the
>objects as they are inserted into them. If you want to preserve the
>ordering, you need to use a Collection that implements the List interface
>(ArrayList, LinkedList) You could use a TreeMap or SortedMap, but these
>would incur more overhead for your application than using a collection that
>implements the List interface.
>
>-Richard