Errors in the book @ ch10
I came to like the errors in the book. They make you think deeper, and you get the understanding that Java isn't quite so easy as Ivor tells you on the front cover.
Ivor(smiling): "It's easier than you think.."
Take this really interesting error I stumbled on in my JDK1.3 version chapter 10 @ page 416. The code example there is erroneous:
transactions.removeAll(transactions.subList(5,15)) ;
If you try this example, a ConcurrentModificationException is thrown.
Why? The API docs offer an explanation.
Because the subList is backed by this List, its 'fail-fast' iterator fails fast.
I think this is a real miss of Ivor, not because of the error itself, but because the concept of 'concurrent modification' deserved some attention in the context of Iterator and List.
Illustrating this with the example the API gives, plus a little explanation, could have been such an elegant contribution to the subject matter in the book:
transactions.subList(5,15).clear();
Don't mistake me: I love the book, and I am much stimulated by the occasional errors in it, how paradoxical this may seem!
FavaQ
onwards to chapter 11
|