This weeks lecture was once again presented by Michael Smith which was once again quite entertaining. The lecture was quite light with consideration given to the submission of the assignment at the start of the lecture. I was quite happy with the assignment, getting most of it done early and being able to consult with Michael on the solutions I had prepared. With some feedback from Michael I was then able to make some improvements and test them before the submission. This seems like it will be the necessary path for all assignments in this course as my failure to consult with the lecturer prior to handing in the Systems and Analysis Assignment 1a resulted in a mediocre mark for a very simple assignment.I suspect we will get the marks back in the first week of May.
In any case, the title of this weeks lecture was ‘Documentation, Identity, Equality and more Collections’. Covering the Java API and its presentation in Javadoc first off. As I learned the Javadoc notation when I first studied Java none of the ensuing slides where new.
Next came the equality of Strings. Again this was one of the first important points mentioned in all Java text books. Basically using the arithmetic operator ‘==’ on two strings (or any objects for that matter) does not evaluate the content of the objects. Thus, if one wants to compare the state of two string objects string1.equals(string2) must be utilized. We spent some time discussing why this is the case, concluding that it the memory location that is compared when using the ‘==’ and that further ‘under the hood’ analysis was beyong the scope of this subject… o_o
We then looked at the immutable nature of Strings, which also applies to ArrayLists and other Collection objects that utilize Arrays.
Interfaces |
Implementations |
|
Hash table |
Resizable array |
Tree |
Linked list |
Hash table + Linked list |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Next came the most interesting part of the lecture.. HashMaps and HashSets (which also leads to other interfaces and implementations of Collections). I don’t have time right now to review all about collections but Michael gave me a great link: http://java.sun.com/docs/books/tutorial/collections/index.html which I will read thoroughly as from my limited experience strong knowledge on this topic is very valuable.