Java Class Libary
We spent today reviewing certain elements of the Java class library. If you missed class, or even if you didn't, you should review the Java documentation (www.java.sun.com) and wrtie some "practice, throw-away code" for the following:
- List interface
- LinkedList and ArrayList classes
- Set interface and HashSet and TreeSet classes
- Map interface and HashMap and TreeMap interfaces
- Iterator interface (and its use(s) with the various classes)
- Comparable interface for "natural ordering"
- Comparator interface (and writing/using specific Comparator objects)
- Arrays class, specifically the sorting and searching methods
- Collections class, specifically the sorting and searching methods
You should also consider some specific odd-ball situations:
- Sorting a Set (List l = Collections.sort(new ArrayList(set.toArray())), or similar using Arrays.sort(...)
- Using the sort methods that take a Comparator to sort in other-than-natural ordering
- Selecting between Tree and Hash implementations (based on need for sorted traversals) and Linked and Array implementations (based on various array vs. linked list tradeoffs)