testing

At 04:11 PM 5/29/2003 -0400, you wrote:
This is done for you automatically with java.util.SortedMap.  If you want
multiple objects referenced by the same key, just put Collection's into the
Map as the values:

SortedMap myMap = new TreeMap();
List myList = new SortedList();
myList.add( object1, object2, object3,...);
myMap.put( "1", myList );

Assuming your List contains people's data who were born on Jan 1, you can
then iterate through the values of the SortedMap with the guarantee that (a)
the keys (representing months) will be sorted in ascending order and the
values will also be sorted in ascending order.

Mark

-----Original Message-----
From: Denis Avdic [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 29, 2003 3:24 PM
To: Struts Users Mailing List
Subject: Re: [WAY OT] Hashtable implementation


Well, if its a map, it helps sorting. I take all elements under one key, dump them into the "bucket" under that key, then get a list of all keys and sort the keys only. So if you have (lets say) 100000 users, and there are only 365 possible birthdays, it is much faster to sort 356 than 100000. Then I have a sorted list of keys and a storage for all 100000 objects, and I have to search only 356 keys to get to (lets say) February 28th birthday, and then I have all the users I want, either in "bucket" or in singular form.



Paul Curren wrote:

> Hi there,
>
> If you want multiple objects under the same key then essentially you
> are just looking for a generic list/collection or whatever you want to
> call it. No?
>
> Or perhaps there are to be multiple lists - a Map containing entries
> that are Collections then I guess.
>
> Paul C
>
> Denis Avdic wrote:
>
>> Hey,
>> I know this is probably a really stupid question but i am looking for
>> a Hashtable (or similar) that will store multiple objects under the
>> same key.
>> I wrote a superficial implementation myself (put, size and get
>> methods only) based on the Hashtable, but I am interested to know if
>> there is something out there already implementing this functionality.
>>
>> Thanks,
>>
>> Denis
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to