Changes 10/23/14
Java:
- Finished lesson on LinkedLists.
- It was informative, they showed how adding a ListNode#getPrevious method and tail variable allowed much faster access to elements more than halfway into the list, since the list could now be iterated both backwards and forwards.
- Learned about iterators, which optimize the traversal of lists based on what kind of list it is. For example, a LinkedList iterator prevents you from needing to call LinkedList#get(i) when traversing, since #get() is an O( n ) operation.
- For each loops in java (ex: for (Object o : list) ) actually use iterators when traversing
- Learned about ListIterators, a subset of iterators that add more methods like #previous(), #add(E x) which adds at the current iterative position, and #set(E x) which sets the current item to x. E is a generic type, meaning that the user sets the actual type when creating the list. As an example, LinkedList<String>() would cause E to be a String.
Cool stuff!
ReplyDelete