Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
And that's just for starters.
Our tour of the framework will begin with an overview of the advantages it provides for storing sets of objects. As you'll
soon discover, because your old workhorse friends Hashtable and Vector support the new API, your programs will be uniform and concise -- something you and the developers accessing your code will
certainly cheer about.
After our preliminary discussion, we'll dig deeper into the details.
Before Collections made its most welcome debut, the standard methods for grouping Java objects were via the array, the Vector, and the Hashtable. All three of these collections have different methods and syntax for accessing members: arrays use the square bracket ([])
symbols, Vector uses the elementAt method, and Hashtable uses get and put methods. These differences have long led programmers down the path to inconsistency in implementing their own collections
-- some emulate the Vector access methods and some emulate the Enumeration interface.
To further complicate matters, most of the Vector methods are marked as final; that is, you cannot extend the Vector class to implement a similar sort of collection. We could create a collection class that looked like a Vector and acted like a Vector, but it couldn't be passed to a method that takes a Vector as a parameter.
Finally, none of the collections (array, Vector or Hashtable) implements a standard member access interface. As programmers developed algorithms (like sorts) to manipulate collections,
a heated discourse erupted on what object to pass to the algorithm. Should you pass an array or a Vector? Should you implement both interfaces? Talk about duplication and confusion.
Thankfully, the Java Collections Framework remedies these problems and offers a number of advantages over using no framework
or using the Vector and Hashtable:
By implementing one of the basic interfaces -- Collection, Set, List, or Map -- you ensure your class conforms to a common API and becomes more regular and easily understood. So, whether you are implementing
an SQL database, a color swatch matcher, or a remote chat application, if you implement the Collection interface, the operations on your collection of objects are well-known to your users. The standard interfaces also simplify
the passing and returning of collections to and from class methods and allow the methods to work on a wider variety of collections.