Algorithms behind the java util package

Gangadhara Melukote
Gangadhara Melukote used Ask the Experts™
on
Dear Experts,

As every java developers knows, there are very frequently used and much handy functionalities provided in java.util package, like search, sort, timer .. etc. I hope these functionalities are built from the principle of certain high performing algorithms to achieve better performance, reliability, durability.  Can anyone please let me know the concepts/algorithms/principles being considered to develop these functionalities?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
I haven't looked under the hood for these Java Utilities. Some of them, such as sort, search are developed using principles in this course:
  http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/

Video lectures are here:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/lecture-videos/
Can anyone please let me know the concepts/algorithms/principles being considered to develop these functionalities?

That's something of a massive question - you do understand there are hundreds of algorithms in java.utils.

Probably the largest collection of algorithms is the collections API.  That was largely designed by Josh Bloch.  He subsequently wrote Effective Java (http://www.amazon.co.uk/Effective-Java-Edition-Joshua-Bloch/dp/0321356683) so you could read that to get an insight into his thinking about good software design principles etc.

That being said, the Java collections API was written more than a decade ago and algorithms have of course progressed significantly since then.  So generally they're "good" but not "the best possible".
Specifically the APIs have problems (quite a lot of interface methods end up being not-implemented, immutable vs mutable data types are basically unsupported etc.).

Google has written a set of enhanced libraries (Guava https://code.google.com/p/guava-libraries/) which help to fill in and improve on those in java.utils.  Sun (Oracle) also added on the concurrency package and generics in later releases which improved on the basic set of algorithms and classes.

Of course all of the code is also open source - so if you're wondering about how exactly hash map implements its hash function - you can just look at the code :)

Hope that helps,

Doug
To help you better understand the Java algorithm code, I recommend that you sign up for this free Coursera course, Algorithms, Part I by Kevin Wayne, Robert Sedgewick

From what I have seen so far in this course, the presentation style starts off a bit easier, and more specific to Java, than the MIT course in my first post. My Coursera email also included this:
If you haven't programmed in Java recently, you might wish to prepare for the course by writing some code, perhaps with the help of our Introduction to Programming in Java textbook and associated free booksite.
I took a look at their booksite. If you know some Java, then this site should be good enough to supplement the Coursera Algorithms course. Part II is also available with Coursera.
Can anyone please let me know the concepts/algorithms/principles being considered to develop these functionalities?

Are you intending to deliver us some improvements?

Author

Commented:
Thanks all for your valuable information. Your answers are leading me in right directions to refresh on core concepts!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial