there is one important thing you need to be aware of, the classic commons lib doesn't support generics... if you need generics you should try out - http://sourceforge.net/projects/collections/
On Tue, Mar 30, 2010 at 11:36 AM, Steven Siebert <[email protected]> wrote: > Duh, the Apache commons...I should have looked there as well, seeing as I'm > using several of their other libraries from the commons. > > Looks like the org.apache.commons.collections.map.LinkedMap class looks > exactly what I'm looking for. > > Thanks! > > Steve > > > On Tue, Mar 30, 2010 at 11:31 AM, Kfir Shay <[email protected]> wrote: >> >> ops completely missed that >> I am not sure this is what you need but it seems similar - >> http://commons.apache.org/collections/api-release/index.html >> >> On Tue, Mar 30, 2010 at 6:35 AM, Steve Siebert <[email protected]> wrote: >> > Hi Kfir, >> > >> > Thanks for the quick reply, but that's one of the classes I referenced >> > in my question stating that it doesn't have the complete API I'm >> > looking for. >> > >> > Thanks, >> > >> > Steve >> > >> > On Mar 29, 9:42 am, Kfir Shay <[email protected]> wrote: >> >> http://java.sun.com/j2se/1.4.2/docs/api/java/util/LinkedHashMap.html >> >> >> >> On Mon, Mar 29, 2010 at 6:33 AM, Steve Siebert <[email protected]> >> >> wrote: >> >> > I'm in need of a doubly-linked HashMap that exposes index mappings as >> >> > well as the key-value pair. An API that exposes a mix of LinkedList >> >> > and HashMap methods. I started withLinkedHashMapbut quickly >> >> > realized I needed to do something like: >> >> >> >> > DoubleLinkedHashMap<String, String> dlHash = new >> >> > DoubleLinkedHashMap<String, String>(); >> >> > //......load the hashmap........ >> >> > int index = dlHash.getLastKey(); >> >> > try { >> >> > String nextKey = dlHash.getKey(index+1); >> >> > //....blah, blah, blah >> >> > } >> >> > catch (IndexOutOfBoundsException ex) >> >> > { >> >> > //...more blah >> >> > } >> >> >> >> > This is a rough API and exposes some possible convenience methods >> >> > (because things like getLastKey() and getKey() should live >> >> > organically >> >> > on the return of keySet()), but I was going for simplicity =). >> >> >> >> > Anyway, I hacked out a collection class to satisfy this requirement >> >> > for the project (a HashMap backed with a LinkedList encapsulated in >> >> > the DoubleLinkedHashMap class), but if anyone knows a similar >> >> > implementation within a common collections library, I would happily >> >> > make a drop-in replacement (just seems like I'm not the only one that >> >> > would need this eventually). I of course checked the Java Collections >> >> > Framework and did a bit of searching within the Google Collections >> >> > library without luck. >> >> >> >> > Thanks! >> >> >> >> > Steve >> >> >> >> > -- >> >> > You received this message because you are subscribed to the Google >> >> > Groups "The Java Posse" group. >> >> > To post to this group, send email to [email protected]. >> >> > To unsubscribe from this group, send email to >> >> > [email protected]. >> >> > For more options, visit this group >> >> > athttp://groups.google.com/group/javaposse?hl=en. >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "The Java Posse" group. >> > To post to this group, send email to [email protected]. >> > To unsubscribe from this group, send email to >> > [email protected]. >> > For more options, visit this group at >> > http://groups.google.com/group/javaposse?hl=en. >> > >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "The Java Posse" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/javaposse?hl=en. >> > > -- > You received this message because you are subscribed to the Google Groups > "The Java Posse" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/javaposse?hl=en. > -- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
