--- old/src/java.base/share/classes/java/util/doc-files/coll-overview.html 2017-08-18 15:03:16.351040758 -0700 +++ new/src/java.base/share/classes/java/util/doc-files/coll-overview.html 2017-08-18 15:03:16.135031310 -0700 @@ -1,7 +1,4 @@ - - - + - - +
+Vector
and Hashtable
, were
retrofitted to implement the collection interfaces.The collection interfaces are divided into two groups.
-The most basic interface, java.util.Collection,
+The most basic interface, java.util.Collection
,
has the following descendants:
java.util.Set
java.util.SortedSet
java.util.NavigableSet
java.util.Queue
java.util.concurrent.BlockingQueue
java.util.concurrent.TransferQueue
java.util.Deque
java.util.concurrent.BlockingDeque
The other collection interfaces are based on java.util.Map and are +
The other collection interfaces are based on java.util.Map
and are
not true collections. However, these interfaces contain
collection-view operations, which enable them to be
-manipulated as collections. Map has the following
+manipulated as collections. Map
has the following
offspring:
java.util.SortedMap
java.util.NavigableMap
java.util.concurrent.ConcurrentMap
java.util.concurrent.ConcurrentNavigableMap
Many of the modification methods in the collection interfaces
are labeled optional. Implementations are permitted to not
perform one or more of these operations, throwing a runtime
-exception (UnsupportedOperationException) if they are
+exception (UnsupportedOperationException
) if they are
attempted. The documentation for each implementation must specify
which optional operations are supported. Several terms are
introduced to aid in this specification:
add
, remove
and clear
) are referred
to as unmodifiable. Collections that are not unmodifiable
are modifiable.Collection
object will be visible are referred to as
immutable. Collections that are not immutable are
mutable.RandomAccess
marker interface enables lists to advertise the fact that they
support random access. This enables generic algorithms to change
their behavior to provide good performance when applied to either
random or sequential access lists.Some implementations restrict what elements (or in the case of
-Maps, keys and values) can be stored. Possible
+Maps
, keys and values) can be stored. Possible
restrictions include requiring elements to:
Attempting to add an element that violates an implementation's
restrictions results in a runtime exception, typically a
-ClassCastException, an IllegalArgumentException,
-or a NullPointerException. Attempting to remove or test
+ClassCastException
, an IllegalArgumentException
,
+or a NullPointerException
. Attempting to remove or test
for the presence of an element that violates an implementation's
restrictions can result in an exception. Some restricted
collections permit this usage.
Classes that implement the collection interfaces typically have names in the form of <Implementation-style><Interface>. The general purpose implementations are summarized in the following table:
-Interface | -Hash Table | -Resizable Array | -Balanced Tree | -Linked List | -Hash Table + Linked List | +Interface | +Hash Table | +Resizable Array | +Balanced Tree | +Linked List | +Hash Table + Linked List |
---|---|---|---|---|---|---|---|---|---|---|---|
Set |
-HashSet | -- | TreeSet | -- | LinkedHashSet | +Set |
+HashSet |
++ | TreeSet |
++ | LinkedHashSet |
List |
-- | ArrayList | -- | LinkedList | -+ | List |
++ | ArrayList |
++ | LinkedList |
+|
Deque |
-- | ArrayDeque | -- | LinkedList | -+ | Deque |
++ | ArrayDeque |
++ | LinkedList |
+|
Map |
-HashMap | -- | TreeMap | -- | LinkedHashMap | +Map |
+HashMap |
++ | TreeMap |
++ | LinkedHashMap |
The general-purpose implementations support all of the
optional operations in the collection interfaces and have no
restrictions on the elements they may contain. They are
-unsynchronized, but the Collections class contains static
+unsynchronized, but the Collections
class contains static
factories called
synchronization wrappers that can be used to add
@@ -256,15 +264,15 @@
implementations have fail-fast iterators, which detect
invalid concurrent modification, and fail quickly and cleanly
(rather than behaving erratically).
The AbstractCollection, AbstractSet, -AbstractList, AbstractSequentialList and -AbstractMap classes provide basic implementations of the +
The AbstractCollection
, AbstractSet
,
+AbstractList
, AbstractSequentialList
and
+AbstractMap
classes provide basic implementations of the
core collection interfaces, to minimize the effort required to
implement them. The API documentation for these classes describes
precisely how each method is implemented so the implementer knows
which methods must be overridden, given the performance of the
basic operations of a specific implementation.
Applications that use collections from more than one thread must be carefully programmed. In general, this is known as concurrent @@ -279,47 +287,47 @@ in concurrent programming.
These concurrent-aware interfaces are available:
BlockingQueue
TransferQueue
BlockingDeque
ConcurrentMap
ConcurrentNavigableMap
The following concurrent-aware implementation classes are available. See the API documentation for the correct usage of these implementations.
LinkedBlockingQueue
ArrayBlockingQueue
PriorityBlockingQueue
DelayQueue
SynchronousQueue
LinkedBlockingDeque
LinkedTransferQueue
+CopyOnWriteArrayList
CopyOnWriteArraySet
ConcurrentSkipListSet
ConcurrentHashMap
ConcurrentSkipListMap
The main design goal was to produce an API that was small in
size and, more importantly, in "conceptual weight." It
@@ -332,7 +340,7 @@
not attempt to capture such subtle distinctions as mutability,
modifiability, and resizability. Instead, certain calls in the core
interfaces are optional, enabling implementations to throw
-an UnsupportedOperationException to indicate that they do
+an UnsupportedOperationException
to indicate that they do
not support a specified optional operation. Collection implementers
must clearly document which optional operations are supported by an
implementation.
It was critical that all reasonable representations of
collections interoperate well. This included arrays, which cannot
-be made to implement the Collection interface directly
+be made to implement the Collection
interface directly
without changing the language. Thus, the framework includes methods
to enable collections to be moved into arrays, arrays to be viewed
as collections, and maps to be viewed as collections.
-Copyright © 1998, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
+Copyright © 1998, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.