You got me, but my guess is that putting together custom object libraries will hamper you in the long run because of maintenance issues. I would also hazard that the way you are doing this is costing you more overhead than casting would do. But what the hell? It's a very extensible language!
Mark -----Original Message----- From: Denis Avdic [mailto:[EMAIL PROTECTED] Sent: Thursday, May 29, 2003 4:25 PM To: Struts Users Mailing List Subject: Re: [WAY OT] Hashtable implementation Well, I want to be able to add one object at a time, and remove them one at a time as well as as collections. Trivial, i know, but I'd rather skip the whole get(key), cast as a list, remove object from list, put(key, list); I already implemented this, I was wondering if someone else has done it, maybe more efficiently etc... Denis Mark Galbreath 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

