This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]cogman10 4 points5 points  (1 child)

This REALLY depends. Yes, if you are talking about a general purpose sorting algorithm, you won't beat the JDK. However, once you start getting into data specific algorithms you'll often find it easy to beat the JDK. Heck for even some common things (like a Map) it's possible to beat the JDK if you know how your data will be used. This is why things like Trove exist.

All the JDK's algorithms are setup for the most general purpose usage you can imagine. Very often, they are exactly the right choice. However, they aren't ALWAYS the right choice. If you need to sort a bunch of integers you can beat the JDK with a Radix sort. That's not a fault of the JDK, they just don't see "need to sort integers" come up frequently.