This week my college class is doing the chapter on the Java Collections Framework. The textbook was very confusing. It looks like there are some interfaces to get familiar with. Then there are multiple classes that implement the interfaces. Other interfaces are involved as well. Initially I was overwhelmed. Now I am trying to focus on a few classes at a time.
I found that Wikipedia has a good overview on the collections. The first class I got familiar with was the HashSet. This thing is a generic class. You need to pass in the type of the items that are stored in the collection. HasSet implements the Set interface. As such, it can only hold unique items in the collection. You add() items to the set. You can also check whether they are already ikn the set with a call to contains().
The second class I played with is HashMap. Do you see a pattern forming here? This class implements the Map interface. You store key/value pairs with this thing. You need to specify the types of the key and value when you create the generic class. Then you put or get key/value pairs.
Most of these collection-related items seems to be in java.util. Let's see if I can figure out all the other classes and interfaces. I am studying it hard.
Be Brave to Get Work Done - I was woken up this morning from a call from work. Not a good sign. Apparently the customer found a potential problem in our delivery. I got on a conferen...
1 day ago