JavaMiscellaneous: Thoughts on the collection package


Thoughts on the collection package

Collection

any(). setAll(). containsAny().

Addable (Sink)

A superinterface of Collection that only allows to add items, in a way the opposite of Iterator.

List/Set/Map

Reference variants of these (i.e. the same except that equals (and hashCode) need not be overridden in a specific way)

Indexable (OrderedCollection)

A superinterface of List that allows index access, but adds items implicitly where it wants to (i.e. you cannot/neednt add items at the index you want to). List.add cannot be used for that purpose because it has to insert at the end.

Iterators

A bidirectional Iterator.

An iterator that keeps track of the current index (compare Indexable), but doesnt (cannot) have all the feature of ListIterator.

MultiMap

MultiSet (Bag)

explicitly, i.e. it has times(Object item) etc.


(C) 2001-2009 Christian Kaufhold (java@chka.de)