jdk/src/java.base/share/classes/java/util/Set.java
author smarks
Fri, 06 May 2016 11:33:32 -0700
changeset 37802 91fc9ac7b8b3
parent 34527 e3caf3a43d09
child 38567 6d4c5a278fff
permissions -rw-r--r--
8139233: add initial compact immutable collection implementations Reviewed-by: plevart, forax, dfuchs, chegar, alanb, scolebourne
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
     2
 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.util;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * A collection that contains no duplicate elements.  More formally, sets
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    30
 * contain no pair of elements {@code e1} and {@code e2} such that
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    31
 * {@code e1.equals(e2)}, and at most one null element.  As implied by
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * its name, this interface models the mathematical <i>set</i> abstraction.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    34
 * <p>The {@code Set} interface places additional stipulations, beyond those
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    35
 * inherited from the {@code Collection} interface, on the contracts of all
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    36
 * constructors and on the contracts of the {@code add}, {@code equals} and
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    37
 * {@code hashCode} methods.  Declarations for other inherited methods are
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * also included here for convenience.  (The specifications accompanying these
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    39
 * declarations have been tailored to the {@code Set} interface, but they do
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * not contain any additional stipulations.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>The additional stipulation on constructors is, not surprisingly,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * that all constructors must create a set that contains no duplicate elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * (as defined above).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <p>Note: Great care must be exercised if mutable objects are used as set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * elements.  The behavior of a set is not specified if the value of an object
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    48
 * is changed in a manner that affects {@code equals} comparisons while the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * object is an element in the set.  A special case of this prohibition is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * that it is not permissible for a set to contain itself as an element.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <p>Some set implementations have restrictions on the elements that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * they may contain.  For example, some implementations prohibit null elements,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * and some have restrictions on the types of their elements.  Attempting to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * add an ineligible element throws an unchecked exception, typically
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
    56
 * {@code NullPointerException} or {@code ClassCastException}.  Attempting
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * to query the presence of an ineligible element may throw an exception,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * or it may simply return false; some implementations will exhibit the former
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * behavior and some will exhibit the latter.  More generally, attempting an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * operation on an ineligible element whose completion would not result in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * the insertion of an ineligible element into the set may throw an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * exception or it may succeed, at the option of the implementation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * Such exceptions are marked as "optional" in the specification for this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 *
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    66
 * <h2><a name="immutable">Immutable Set Static Factory Methods</a></h2>
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    67
 * <p>The {@link Set#of(Object...) Set.of()} static factory methods
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    68
 * provide a convenient way to create immutable sets. The {@code Set}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    69
 * instances created by these methods have the following characteristics:
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    70
 *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    71
 * <ul>
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    72
 * <li>They are <em>structurally immutable</em>. Elements cannot be added or
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    73
 * removed. Attempts to do so result in {@code UnsupportedOperationException}.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    74
 * However, if the contained elements are themselves mutable, this may cause the
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    75
 * Set to behave inconsistently or its contents to appear to change.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    76
 * <li>They disallow {@code null} elements. Attempts to create them with
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    77
 * {@code null} elements result in {@code NullPointerException}.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    78
 * <li>They are serializable if all elements are serializable.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    79
 * <li>They reject duplicate elements at creation time. Duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    80
 * passed to a static factory method result in {@code IllegalArgumentException}.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    81
 * <li>The iteration order of set elements is unspecified and is subject to change.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    82
 * <li>They are <a href="../lang/doc-files/ValueBased.html">value-based</a>.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    83
 * Callers should make no assumptions about the identity of the returned instances.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    84
 * Factories are free to create new instances or reuse existing ones. Therefore,
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    85
 * identity-sensitive operations on these instances (reference equality ({@code ==}),
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    86
 * identity hash code, and synchronization) are unreliable and should be avoided.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    87
 * </ul>
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
    88
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * <p>This interface is a member of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * <a href="{@docRoot}/../technotes/guides/collections/index.html">
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * Java Collections Framework</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * @param <E> the type of elements maintained by this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * @author  Josh Bloch
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * @author  Neal Gafter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * @see Collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * @see List
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * @see SortedSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * @see HashSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * @see TreeSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * @see AbstractSet
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * @see Collections#singleton(java.lang.Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * @see Collections#EMPTY_SET
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * @since 1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
public interface Set<E> extends Collection<E> {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    // Query Operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * Returns the number of elements in this set (its cardinality).  If this
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   113
     * set contains more than {@code Integer.MAX_VALUE} elements, returns
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   114
     * {@code Integer.MAX_VALUE}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @return the number of elements in this set (its cardinality)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    int size();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    /**
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   121
     * Returns {@code true} if this set contains no elements.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     *
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   123
     * @return {@code true} if this set contains no elements
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    boolean isEmpty();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    /**
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   128
     * Returns {@code true} if this set contains the specified element.
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   129
     * More formally, returns {@code true} if and only if this set
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   130
     * contains an element {@code e} such that
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   131
     * {@code Objects.equals(o, e)}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * @param o element whose presence in this set is to be tested
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   134
     * @return {@code true} if this set contains the specified element
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * @throws ClassCastException if the type of the specified element
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   136
     *         is incompatible with this set
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   137
     * (<a href="Collection.html#optional-restrictions">optional</a>)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @throws NullPointerException if the specified element is null and this
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   139
     *         set does not permit null elements
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   140
     * (<a href="Collection.html#optional-restrictions">optional</a>)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    boolean contains(Object o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * Returns an iterator over the elements in this set.  The elements are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * returned in no particular order (unless this set is an instance of some
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * class that provides a guarantee).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * @return an iterator over the elements in this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    Iterator<E> iterator();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * Returns an array containing all of the elements in this set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * If this set makes any guarantees as to what order its elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * are returned by its iterator, this method must return the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * elements in the same order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * <p>The returned array will be "safe" in that no references to it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * are maintained by this set.  (In other words, this method must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * allocate a new array even if this set is backed by an array).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * The caller is thus free to modify the returned array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * <p>This method acts as bridge between array-based and collection-based
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * APIs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * @return an array containing all the elements in this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    Object[] toArray();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Returns an array containing all of the elements in this set; the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * runtime type of the returned array is that of the specified array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * If the set fits in the specified array, it is returned therein.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * Otherwise, a new array is allocated with the runtime type of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * specified array and the size of this set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * <p>If this set fits in the specified array with room to spare
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * (i.e., the array has more elements than this set), the element in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * the array immediately following the end of the set is set to
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   181
     * {@code null}.  (This is useful in determining the length of this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
     * set <i>only</i> if the caller knows that this set does not contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
     * any null elements.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * <p>If this set makes any guarantees as to what order its elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * are returned by its iterator, this method must return the elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * in the same order.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * <p>Like the {@link #toArray()} method, this method acts as bridge between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * array-based and collection-based APIs.  Further, this method allows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * precise control over the runtime type of the output array, and may,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * under certain circumstances, be used to save allocation costs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     *
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   194
     * <p>Suppose {@code x} is a set known to contain only strings.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * The following code can be used to dump the set into a newly allocated
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   196
     * array of {@code String}:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     *     String[] y = x.toArray(new String[0]);</pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     *
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   201
     * Note that {@code toArray(new Object[0])} is identical in function to
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   202
     * {@code toArray()}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * @param a the array into which the elements of this set are to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     *        stored, if it is big enough; otherwise, a new array of the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     *        runtime type is allocated for this purpose.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * @return an array containing all the elements in this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * @throws ArrayStoreException if the runtime type of the specified array
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     *         is not a supertype of the runtime type of every element in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     *         set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * @throws NullPointerException if the specified array is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    <T> T[] toArray(T[] a);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    // Modification Operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * Adds the specified element to this set if it is not already present
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * (optional operation).  More formally, adds the specified element
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   221
     * {@code e} to this set if the set contains no element {@code e2}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * such that
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   223
     * {@code Objects.equals(e, e2)}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * If this set already contains the element, the call leaves the set
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   225
     * unchanged and returns {@code false}.  In combination with the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * restriction on constructors, this ensures that sets never contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     * duplicate elements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * <p>The stipulation above does not imply that sets must accept all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * elements; sets may refuse to add any particular element, including
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   231
     * {@code null}, and throw an exception, as described in the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * specification for {@link Collection#add Collection.add}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * Individual set implementations should clearly document any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * restrictions on the elements that they may contain.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
     * @param e element to be added to this set
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   237
     * @return {@code true} if this set did not already contain the specified
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     *         element
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   239
     * @throws UnsupportedOperationException if the {@code add} operation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     *         is not supported by this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * @throws ClassCastException if the class of the specified element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     *         prevents it from being added to this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @throws NullPointerException if the specified element is null and this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     *         set does not permit null elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     * @throws IllegalArgumentException if some property of the specified element
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
     *         prevents it from being added to this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    boolean add(E e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * Removes the specified element from this set if it is present
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   253
     * (optional operation).  More formally, removes an element {@code e}
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * such that
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   255
     * {@code Objects.equals(o, e)}, if
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   256
     * this set contains such an element.  Returns {@code true} if this set
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     * contained the element (or equivalently, if this set changed as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
     * result of the call).  (This set will not contain the element once the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
     * call returns.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * @param o object to be removed from this set, if present
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   262
     * @return {@code true} if this set contained the specified element
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @throws ClassCastException if the type of the specified element
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   264
     *         is incompatible with this set
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   265
     * (<a href="Collection.html#optional-restrictions">optional</a>)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @throws NullPointerException if the specified element is null and this
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   267
     *         set does not permit null elements
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   268
     * (<a href="Collection.html#optional-restrictions">optional</a>)
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   269
     * @throws UnsupportedOperationException if the {@code remove} operation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
     *         is not supported by this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    boolean remove(Object o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    // Bulk Operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    /**
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   278
     * Returns {@code true} if this set contains all of the elements of the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * specified collection.  If the specified collection is also a set, this
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   280
     * method returns {@code true} if it is a <i>subset</i> of this set.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @param  c collection to be checked for containment in this set
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   283
     * @return {@code true} if this set contains all of the elements of the
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     *         specified collection
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @throws ClassCastException if the types of one or more elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     *         in the specified collection are incompatible with this
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   287
     *         set
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   288
     * (<a href="Collection.html#optional-restrictions">optional</a>)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
     * @throws NullPointerException if the specified collection contains one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
     *         or more null elements and this set does not permit null
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   291
     *         elements
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   292
     * (<a href="Collection.html#optional-restrictions">optional</a>),
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   293
     *         or if the specified collection is null
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * @see    #contains(Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    boolean containsAll(Collection<?> c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * Adds all of the elements in the specified collection to this set if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * they're not already present (optional operation).  If the specified
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   301
     * collection is also a set, the {@code addAll} operation effectively
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * modifies this set so that its value is the <i>union</i> of the two
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * sets.  The behavior of this operation is undefined if the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * collection is modified while the operation is in progress.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @param  c collection containing elements to be added to this set
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   307
     * @return {@code true} if this set changed as a result of the call
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     *
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   309
     * @throws UnsupportedOperationException if the {@code addAll} operation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     *         is not supported by this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * @throws ClassCastException if the class of an element of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     *         specified collection prevents it from being added to this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * @throws NullPointerException if the specified collection contains one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     *         or more null elements and this set does not permit null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     *         elements, or if the specified collection is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * @throws IllegalArgumentException if some property of an element of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     *         specified collection prevents it from being added to this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * @see #add(Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    boolean addAll(Collection<? extends E> c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * Retains only the elements in this set that are contained in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * specified collection (optional operation).  In other words, removes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     * from this set all of its elements that are not contained in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
     * specified collection.  If the specified collection is also a set, this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
     * operation effectively modifies this set so that its value is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * <i>intersection</i> of the two sets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * @param  c collection containing elements to be retained in this set
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   331
     * @return {@code true} if this set changed as a result of the call
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   332
     * @throws UnsupportedOperationException if the {@code retainAll} operation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     *         is not supported by this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * @throws ClassCastException if the class of an element of this set
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   335
     *         is incompatible with the specified collection
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   336
     * (<a href="Collection.html#optional-restrictions">optional</a>)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * @throws NullPointerException if this set contains a null element and the
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   338
     *         specified collection does not permit null elements
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   339
     *         (<a href="Collection.html#optional-restrictions">optional</a>),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     *         or if the specified collection is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @see #remove(Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    boolean retainAll(Collection<?> c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * Removes from this set all of its elements that are contained in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * specified collection (optional operation).  If the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * collection is also a set, this operation effectively modifies this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * set so that its value is the <i>asymmetric set difference</i> of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * the two sets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * @param  c collection containing elements to be removed from this set
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   353
     * @return {@code true} if this set changed as a result of the call
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   354
     * @throws UnsupportedOperationException if the {@code removeAll} operation
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     *         is not supported by this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * @throws ClassCastException if the class of an element of this set
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   357
     *         is incompatible with the specified collection
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   358
     * (<a href="Collection.html#optional-restrictions">optional</a>)
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @throws NullPointerException if this set contains a null element and the
9503
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   360
     *         specified collection does not permit null elements
588cf31d584a 6546713: link the word (optional) in exception specifications to the text which provides explanation and context.
mduigou
parents: 5506
diff changeset
   361
     *         (<a href="Collection.html#optional-restrictions">optional</a>),
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     *         or if the specified collection is null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     * @see #remove(Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
     * @see #contains(Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    boolean removeAll(Collection<?> c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * Removes all of the elements from this set (optional operation).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * The set will be empty after this call returns.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     *
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   372
     * @throws UnsupportedOperationException if the {@code clear} method
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     *         is not supported by this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    void clear();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    // Comparison and hashing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * Compares the specified object with this set for equality.  Returns
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   382
     * {@code true} if the specified object is also a set, the two sets
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
     * have the same size, and every member of the specified set is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
     * contained in this set (or equivalently, every member of this set is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
     * contained in the specified set).  This definition ensures that the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
     * equals method works properly across different implementations of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * set interface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * @param o object to be compared for equality with this set
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   390
     * @return {@code true} if the specified object is equal to this set
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    boolean equals(Object o);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
     * Returns the hash code value for this set.  The hash code of a set is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
     * defined to be the sum of the hash codes of the elements in the set,
32108
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   397
     * where the hash code of a {@code null} element is defined to be zero.
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   398
     * This ensures that {@code s1.equals(s2)} implies that
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   399
     * {@code s1.hashCode()==s2.hashCode()} for any two sets {@code s1}
aa5490a167ee 8133188: docs: replace <tt> tags (obsolete in html5) for java.util
avstepan
parents: 25859
diff changeset
   400
     * and {@code s2}, as required by the general contract of
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * {@link Object#hashCode}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * @return the hash code value for this set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * @see Object#equals(Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * @see Set#equals(Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    int hashCode();
16929
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   408
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   409
    /**
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   410
     * Creates a {@code Spliterator} over the elements in this set.
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   411
     *
20489
cce02e4a6cbe 8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents: 19435
diff changeset
   412
     * <p>The {@code Spliterator} reports {@link Spliterator#DISTINCT}.
cce02e4a6cbe 8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents: 19435
diff changeset
   413
     * Implementations should document the reporting of additional
cce02e4a6cbe 8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents: 19435
diff changeset
   414
     * characteristic values.
16929
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   415
     *
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   416
     * @implSpec
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   417
     * The default implementation creates a
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   418
     * <em><a href="Spliterator.html#binding">late-binding</a></em> spliterator
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   419
     * from the set's {@code Iterator}.  The spliterator inherits the
19435
9d7530ff42cb 8014824: Document Spliterator characteristics and binding policy of java util collection impls
psandoz
parents: 16929
diff changeset
   420
     * <em>fail-fast</em> properties of the set's iterator.
20489
cce02e4a6cbe 8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents: 19435
diff changeset
   421
     * <p>
cce02e4a6cbe 8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents: 19435
diff changeset
   422
     * The created {@code Spliterator} additionally reports
cce02e4a6cbe 8024408: Specifications for Collection/List/Set/SortedSet.spliterator() need to document if all the (subclass) instances are required to return SIZED spliterators
psandoz
parents: 19435
diff changeset
   423
     * {@link Spliterator#SIZED}.
16929
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   424
     *
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   425
     * @implNote
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   426
     * The created {@code Spliterator} additionally reports
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   427
     * {@link Spliterator#SUBSIZED}.
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   428
     *
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   429
     * @return a {@code Spliterator} over the elements in this set
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   430
     * @since 1.8
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   431
     */
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   432
    @Override
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   433
    default Spliterator<E> spliterator() {
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   434
        return Spliterators.spliterator(this, Spliterator.DISTINCT);
c984ae5655cb 8010096: Initial java.util.Spliterator putback
briangoetz
parents: 14342
diff changeset
   435
    }
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   436
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   437
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   438
     * Returns an immutable set containing zero elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   439
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   440
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   441
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   442
     * @return an empty {@code Set}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   443
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   444
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   445
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   446
    static <E> Set<E> of() {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   447
        return new ImmutableCollections.Set0<>();
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   448
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   449
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   450
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   451
     * Returns an immutable set containing one element.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   452
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   453
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   454
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   455
     * @param e1 the single element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   456
     * @return a {@code Set} containing the specified element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   457
     * @throws NullPointerException if the element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   458
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   459
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   460
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   461
    static <E> Set<E> of(E e1) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   462
        return new ImmutableCollections.Set1<>(e1);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   463
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   464
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   465
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   466
     * Returns an immutable set containing two elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   467
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   468
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   469
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   470
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   471
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   472
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   473
     * @throws IllegalArgumentException if the elements are duplicates
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   474
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   475
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   476
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   477
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   478
    static <E> Set<E> of(E e1, E e2) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   479
        return new ImmutableCollections.Set2<>(e1, e2);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   480
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   481
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   482
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   483
     * Returns an immutable set containing three elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   484
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   485
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   486
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   487
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   488
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   489
     * @param e3 the third element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   490
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   491
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   492
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   493
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   494
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   495
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   496
    static <E> Set<E> of(E e1, E e2, E e3) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   497
        return new ImmutableCollections.SetN<>(e1, e2, e3);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   498
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   499
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   500
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   501
     * Returns an immutable set containing four elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   502
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   503
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   504
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   505
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   506
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   507
     * @param e3 the third element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   508
     * @param e4 the fourth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   509
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   510
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   511
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   512
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   513
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   514
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   515
    static <E> Set<E> of(E e1, E e2, E e3, E e4) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   516
        return new ImmutableCollections.SetN<>(e1, e2, e3, e4);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   517
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   518
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   519
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   520
     * Returns an immutable set containing five elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   521
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   522
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   523
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   524
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   525
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   526
     * @param e3 the third element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   527
     * @param e4 the fourth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   528
     * @param e5 the fifth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   529
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   530
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   531
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   532
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   533
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   534
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   535
    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   536
        return new ImmutableCollections.SetN<>(e1, e2, e3, e4, e5);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   537
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   538
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   539
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   540
     * Returns an immutable set containing six elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   541
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   542
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   543
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   544
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   545
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   546
     * @param e3 the third element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   547
     * @param e4 the fourth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   548
     * @param e5 the fifth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   549
     * @param e6 the sixth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   550
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   551
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   552
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   553
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   554
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   555
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   556
    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   557
        return new ImmutableCollections.SetN<>(e1, e2, e3, e4, e5,
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   558
                                               e6);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   559
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   560
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   561
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   562
     * Returns an immutable set containing seven elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   563
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   564
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   565
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   566
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   567
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   568
     * @param e3 the third element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   569
     * @param e4 the fourth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   570
     * @param e5 the fifth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   571
     * @param e6 the sixth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   572
     * @param e7 the seventh element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   573
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   574
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   575
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   576
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   577
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   578
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   579
    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   580
        return new ImmutableCollections.SetN<>(e1, e2, e3, e4, e5,
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   581
                                               e6, e7);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   582
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   583
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   584
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   585
     * Returns an immutable set containing eight elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   586
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   587
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   588
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   589
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   590
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   591
     * @param e3 the third element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   592
     * @param e4 the fourth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   593
     * @param e5 the fifth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   594
     * @param e6 the sixth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   595
     * @param e7 the seventh element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   596
     * @param e8 the eighth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   597
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   598
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   599
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   600
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   601
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   602
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   603
    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   604
        return new ImmutableCollections.SetN<>(e1, e2, e3, e4, e5,
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   605
                                               e6, e7, e8);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   606
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   607
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   608
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   609
     * Returns an immutable set containing nine elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   610
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   611
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   612
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   613
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   614
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   615
     * @param e3 the third element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   616
     * @param e4 the fourth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   617
     * @param e5 the fifth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   618
     * @param e6 the sixth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   619
     * @param e7 the seventh element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   620
     * @param e8 the eighth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   621
     * @param e9 the ninth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   622
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   623
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   624
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   625
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   626
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   627
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   628
    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   629
        return new ImmutableCollections.SetN<>(e1, e2, e3, e4, e5,
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   630
                                               e6, e7, e8, e9);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   631
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   632
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   633
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   634
     * Returns an immutable set containing ten elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   635
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   636
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   637
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   638
     * @param e1 the first element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   639
     * @param e2 the second element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   640
     * @param e3 the third element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   641
     * @param e4 the fourth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   642
     * @param e5 the fifth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   643
     * @param e6 the sixth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   644
     * @param e7 the seventh element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   645
     * @param e8 the eighth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   646
     * @param e9 the ninth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   647
     * @param e10 the tenth element
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   648
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   649
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   650
     * @throws NullPointerException if an element is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   651
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   652
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   653
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   654
    static <E> Set<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   655
        return new ImmutableCollections.SetN<>(e1, e2, e3, e4, e5,
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   656
                                               e6, e7, e8, e9, e10);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   657
    }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   658
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   659
    /**
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   660
     * Returns an immutable set containing an arbitrary number of elements.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   661
     * See <a href="#immutable">Immutable Set Static Factory Methods</a> for details.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   662
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   663
     * @apiNote
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   664
     * This method also accepts a single array as an argument. The element type of
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   665
     * the resulting set will be the component type of the array, and the size of
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   666
     * the set will be equal to the length of the array. To create a set with
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   667
     * a single element that is an array, do the following:
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   668
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   669
     * <pre>{@code
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   670
     *     String[] array = ... ;
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   671
     *     Set<String[]> list = Set.<String[]>of(array);
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   672
     * }</pre>
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   673
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   674
     * This will cause the {@link Set#of(Object) Set.of(E)} method
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   675
     * to be invoked instead.
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   676
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   677
     * @param <E> the {@code Set}'s element type
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   678
     * @param elements the elements to be contained in the set
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   679
     * @return a {@code Set} containing the specified elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   680
     * @throws IllegalArgumentException if there are any duplicate elements
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   681
     * @throws NullPointerException if an element is {@code null} or if the array is {@code null}
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   682
     *
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   683
     * @since 9
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   684
     */
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   685
    @SafeVarargs
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   686
    @SuppressWarnings("varargs")
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   687
    static <E> Set<E> of(E... elements) {
37802
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   688
        Objects.requireNonNull(elements);
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   689
        switch (elements.length) {
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   690
            case 0:
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   691
                return new ImmutableCollections.Set0<>();
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   692
            case 1:
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   693
                return new ImmutableCollections.Set1<>(elements[0]);
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   694
            case 2:
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   695
                return new ImmutableCollections.Set2<>(elements[0], elements[1]);
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   696
            default:
91fc9ac7b8b3 8139233: add initial compact immutable collection implementations
smarks
parents: 34527
diff changeset
   697
                return new ImmutableCollections.SetN<>(elements);
34527
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   698
        }
e3caf3a43d09 8139232: JEP-269 initial API and skeleton implementations
smarks
parents: 32108
diff changeset
   699
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
}