Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>Collection</code> is an interface that specifies a group of objects known as <em>elements</em>. The details of how the group of elements is maintained is left up to the concrete implementations of <code>Collection</code>. For example, some <code>Collection</code> implementations like <code>List</code> allow duplicate elements whereas other implementations like <code>Set</code> don't. A lot of the <code>Collection</code> implementations have a public <code>clone</code> method. However, it does't really make sense to include it in all implementations of <code>Collection</code>. This is because <code>Collection</code> is an abstract representation. What matters is the implementation. The semantics and the implications of either cloning or serializing come into play when dealing with the <em>actual</em> implementation; that is, the concrete implementation should decide how it should be cloned or serialized, or even <em>if</em> it can be cloned or serialized. In some cases, depending on what the actual backing-implementation is, cloning and serialization may not make much sense. So mandating cloning and serialization in <em>all</em> implementations is actually less flexible and more restrictive. The specific implementation should make the decision as to whether it can be cloned or serialized.</p> <p>Here's an <a href="http://docs.oracle.com/javase/6/docs/technotes/guides/collections/designfaq.html#5">explanation</a> from Oracle's documentation:</p> <blockquote> <p>Many Collection implementations (including all of the ones provided by the JDK) will have a public clone method, but it would be mistake to require it of all Collections. For example, what does it mean to clone a Collection that's backed by a terabyte SQL database? Should the method call cause the company to requisition a new disk farm? Similar arguments hold for serializable.</p> <p>If the client doesn't know the actual type of a Collection, it's much more flexible and less error prone to have the client decide what type of Collection is desired, create an empty Collection of this type, and use the addAll method to copy the elements of the original collection into the new one.</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload