< prev index next >

src/java.base/share/classes/java/util/Set.java

Print this page




  75  * will always cause {@code UnsupportedOperationException} to be thrown.
  76  * However, if the contained elements are themselves mutable, this may cause the
  77  * Set to behave inconsistently or its contents to appear to change.
  78  * <li>They disallow {@code null} elements. Attempts to create them with
  79  * {@code null} elements result in {@code NullPointerException}.
  80  * <li>They are serializable if all elements are serializable.
  81  * <li>They reject duplicate elements at creation time. Duplicate elements
  82  * passed to a static factory method result in {@code IllegalArgumentException}.
  83  * <li>The iteration order of set elements is unspecified and is subject to change.
  84  * <li>They are <a href="../lang/doc-files/ValueBased.html">value-based</a>.
  85  * Callers should make no assumptions about the identity of the returned instances.
  86  * Factories are free to create new instances or reuse existing ones. Therefore,
  87  * identity-sensitive operations on these instances (reference equality ({@code ==}),
  88  * identity hash code, and synchronization) are unreliable and should be avoided.
  89  * <li>They are serialized as specified on the
  90  * <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
  91  * page.
  92  * </ul>
  93  *
  94  * <p>This interface is a member of the
  95  * <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework">
  96  * Java Collections Framework</a>.
  97  *
  98  * @param <E> the type of elements maintained by this set
  99  *
 100  * @author  Josh Bloch
 101  * @author  Neal Gafter
 102  * @see Collection
 103  * @see List
 104  * @see SortedSet
 105  * @see HashSet
 106  * @see TreeSet
 107  * @see AbstractSet
 108  * @see Collections#singleton(java.lang.Object)
 109  * @see Collections#EMPTY_SET
 110  * @since 1.2
 111  */
 112 
 113 public interface Set<E> extends Collection<E> {
 114     // Query Operations
 115 




  75  * will always cause {@code UnsupportedOperationException} to be thrown.
  76  * However, if the contained elements are themselves mutable, this may cause the
  77  * Set to behave inconsistently or its contents to appear to change.
  78  * <li>They disallow {@code null} elements. Attempts to create them with
  79  * {@code null} elements result in {@code NullPointerException}.
  80  * <li>They are serializable if all elements are serializable.
  81  * <li>They reject duplicate elements at creation time. Duplicate elements
  82  * passed to a static factory method result in {@code IllegalArgumentException}.
  83  * <li>The iteration order of set elements is unspecified and is subject to change.
  84  * <li>They are <a href="../lang/doc-files/ValueBased.html">value-based</a>.
  85  * Callers should make no assumptions about the identity of the returned instances.
  86  * Factories are free to create new instances or reuse existing ones. Therefore,
  87  * identity-sensitive operations on these instances (reference equality ({@code ==}),
  88  * identity hash code, and synchronization) are unreliable and should be avoided.
  89  * <li>They are serialized as specified on the
  90  * <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
  91  * page.
  92  * </ul>
  93  *
  94  * <p>This interface is a member of the
  95  * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
  96  * Java Collections Framework</a>.
  97  *
  98  * @param <E> the type of elements maintained by this set
  99  *
 100  * @author  Josh Bloch
 101  * @author  Neal Gafter
 102  * @see Collection
 103  * @see List
 104  * @see SortedSet
 105  * @see HashSet
 106  * @see TreeSet
 107  * @see AbstractSet
 108  * @see Collections#singleton(java.lang.Object)
 109  * @see Collections#EMPTY_SET
 110  * @since 1.2
 111  */
 112 
 113 public interface Set<E> extends Collection<E> {
 114     // Query Operations
 115 


< prev index next >