View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007


Figuring out Collections

I wanted a java.util.Vector. Plain and simple. So I pulled up a browser and did a search for Vector, but to my dismay there was no Vector class. What to do? Well, I needed something dynamic, that's for sure. I figured I could write my own Vector class from scratch, but that seemed pretty silly. Instead, I went hunting for something, anything I could use.

LinkedList? That sounded pretty good. So I began working with the LinkedList class. As I delved into the class I discovered that there were no easy-add methods. Rather, there existed separate Link classes that served as nodes... and those didn't even have space for data! So I began subclassing Link class and adding features like a generic data variable and such. After a while I had something moderately useful.

The next day it dawned upon me (as do many things I should have thought of earlier): "Shouldn't a language that prides itself on reuse and pre-built components have dynamic, generic, index-addressable data-structure-class?" I mean it seemed like a very basic class that would get used very often.

Two minutes later I had located the OrderedCollection class, and shortly thereafter replaced all references to LinkedList with OrderedCollection. Thus ended the saga of the JorgeVector class. Woohoo!

Link to this Page