Chapter 10. The Main Interfaces of the Java Collections Framework
Figure 10-1 shows the
main interfaces of the Java Collections Framework, together with one other—Iterable—which is outside the Framework but is an
essential adjunct to it. Its purpose is as follows:
Iterabledefines the contract that a class has to fulfill for its instances to be usable with the foreach statement.
And the Framework interfaces have the following purposes:
Collectioncontains the core functionality required of any collection other than a map. It has no direct concrete implementations; the concrete collection classes all implement one of its subinterfaces as well.Setis a collection, without duplicates, in which order is not significant.SortedSetautomatically sorts its elements and returns them in order.NavigableSetextends this, adding methods to find the closest matches to a target element.Queueis a collection designed to accept elements at its tail for processing, yielding them up at its head in the order in which they are to be processed. Its subinterfaceDequeextends this by allowing elements to be added or removed at both head and tail.QueueandDequehave subinterfaces,BlockingQueueandBlockingDequerespectively, that support concurrent access and allow threads to be blocked, indefinitely or for a maximum time, until the requested operation can be carried out.Listis a collection in which order is significant, accommodating duplicate elements.Mapis a collection which uses key-value associations ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access