views:

695

answers:

8

Hi,

I'm astonished that the Apache Commons Collections project still hasn't got around to making their library generics-aware. I really like the features provided by this library, but the lack of support for generics is a big turn-off. There is a Lavalabs fork of Commons Collections which does support generics, which seems to claim backward compatibility, but when I tried updating to this version, my web application failed to start (in JBoss).

My questions are:

  • Whether anyone has successfully updated from Commons Collections to the fork mentioned above
  • If Commons Collections has any plans to add support for generics

BTW, I'm aware of Google collections, but am reluctant to use it until the API stabilises.

Cheers, Don

+5  A: 

Given that the last word in Jakarta's own internal debate was in Dec 07, I would say that Apache will not embrace generics, leaving the field open for something Java5 friendly like Google Collections.

jamesh
A: 

Ignore. Missed link in original question.

james
Have you considered deleting this altogether?
Jonik
+6  A: 

Hey Don,

There are contributions. Checkout the jira's

There is also a JDK5 branch.

We do would like to add generics and update Commons Collections to 1.5 (and 1.6). The biggest problem is how to address backwards compatibility. And people have very different opinions there. For some of the Commons components the newer JDK almost asks for a rewrite for the new JDKs IMHO.

During ApacheCon I felt the urge across several people to get this moving though. It's just a big task.

Feel free to show up on [email protected]

cheers, Torsten

tcurdt
Thanks Torsten. I'm a bit relucant to bring this up on the mailing list as I expect it's already been discussed a million times. I'll check out the JDK5 branch
Don
Question: You do know that JDK 1.4 is no longer supported by sun?
geeeeeeeeeek
Just bring it up. We need the pressure :)
tcurdt
@geek: yes it is, you just have to pay for that support
skaffman
A: 

I can't imagine what reason you can have to don't use google collections. It's quite simple to use that library.

For my work i use both, apache collections and google collections.

can you explain more about why you can't use google collections?

regards

damian
One reason is because my application already includes commons collections (e.g. as a transitive dependency of another Apache library). If it was possible, I would prefer to upgrade to a generics version of commons collections that introduce another dependency.
Don
+5  A: 

Consider Google Collections. From their Javalobby interview:

[Google Collections is] built with Java 5 features: generics, enums, covariant return types, etc. When writing Java 5 code, you want a collections library that takes full advantage of the language. In addition, we put enormous effort into making the library complete, robust, and consistent with the JDK collection classes.

Jesse Wilson
A: 

I say, bite the bullet and switch to google-collections, at least for new code.

I know you're concerned about stability, but the google-collections library is VERY close to stable for 1.0 release -- hang out on the dev list or watch their reported issues, they are already very very cautious about changes, especially breaking ones. Any incompatibilities between the current release and the (seemingly imminent) 1.0 final are going to be extremely tiny.

Also, if you're worried about stability, pick a version (e.g. the current one, 1.0 RC4), and... just don't upgrade. Sure, you won't get any new features, but commons-collections hasn't been updated in a meaningful way in several years, so are you really any worse off? At least you're frozen on something with generics and (IMHO) a much better API.

Cowan
A: 

There's a genericised port of Commons Collections 3.1 available here, which we've been using for a few years now. Does the job nicely, and since it's based strictly on the existing Commons source, it has a stable API.

It could use updating to conform to Commons Collections 3.2, though.

skaffman
A: 

Have a read on the collection blog, it provide the completed understanding of the collection framework. http://tech.konnectingtheworld.com/2010/09/a-note-on-java-collections/

If you feel that you query has not been answered, get in touch with me. I shall try to provide you the information as much as I can.

Konnect