views:

230

answers:

3

I have always been using the stock JDK collections in my code. Does the Apache Commons Collections framework run faster?

+3  A: 

No, it's just more comprehensive and more comfortable.

Aaron Digulla
+5  A: 

No, it is not faster. And it doesn't support generics.

For a new project that needs something beyond JDK Collections, I can't understand why anyone would choose Commons Collections over the Google Collections Library.

erickson
many projects like hibernate are already using Commons Collections and you dont have to add extra jar to the project. thats the reason.
01
Sometimes adding new dependencies do increase the productivity/quality of code/performance significantly enough to warrant the inclusion of additional libraries, so just because you have something already doesn't automatically mean you shouldn't add another library (or replace the original with) which does sort of the same thing.
Esko
@01: That's not a new project that needs something beyond JDK Collections. That's an existing project that's already saddled with Commons. Whether the effort to replace it with something better is worthwhile depends on the circumstances.
erickson
A: 

You're sort of missing the point, because Apache Commons Collections was never meant to be a replacement of the Java Collections framework.

Like it says on the project's home page:

Commons-Collections seek to build upon the JDK classes by providing new interfaces, implementations and utilities.

Anyway, like erickson pointed out, you're better off with Google Collections if you are using Java collections and want something to complement it. As to why it should be better than Commons Collections (which erickson forgot to address), see e.g. this answer and the interview mentioned in it.

Jonik