Professional Documents
Culture Documents
05a - Using Collections
05a - Using Collections
1 General introduction
The next page describes four exercises, all aimed at implementing specialized
forms of collections. A few general remarks:
All these exercises rely on using delegation far more than on other
behaviour-extending mechanisms. If you do not understand delegation,
check for example http://en.wikipedia.org/wiki/Delegation_pattern
Think on how to test the result you'll have at the end. Even better is
to define test code before starting the rest.
Make designs for the relevant methods. An IPO and a NassiSchneidermann diagram are good things to make when doing this.
2 Exercises
2.1 Observable List
We need a List which also is Observable. That means:
Your task is to implement this. Do not use the JavaFX class ObservableList; the
idea of this exercise is not to just take a canned class.
2.4 SortedHashMap
We need a special form of a Map:
Sorting order is based on the natural ordening of the Values, not the Keys
o