>Well yes, they implement it, but those classes are not always exposed
>in the API.
That's true, but Sequence, Dictionary, and Group can't implement Iterable if we
want to support combining interfaces. This may not be a common use case, but it
is a valid one (for example, an XML element is easily modeled as a
DictionarySequence).
Honestly, we've been working with this API as-is for quite a while, and I've
never found it to be a significant inconvenience. In fact, I rather like the
elegance of code like the following:
for (int i = 0, n = mySequence.getLength(); i < n; i++) {
...
}
Sure, it's slightly more verbose than a for..each, but by no means is it
cumbersome or ugly. It also avoids the heap allocation of the iterator.
>There are also other places where Component's return or accept
>Sequence in the API.
We often use Sequences when we want to make it clear that a caller should not
expect the operation to automatically respond to change events, as they might
if the methods took a List as an argument, for example.