| Modifier and Type | Class and Description |
|---|---|
| private class | ArraySet.
Iterator |
| Modifier and Type | Field and Description |
|---|---|
| private volatile T[] | |
| private final Class | |
| private final boolean | |
| private final Object |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public final boolean | Returns: true, if at least one element was added to the set and, as result, the size of the set was increased, or false, all element(s) was/were present in the set and, as the result, the set values were just reset.the elements to add. source)Implements java. Add all the elements from the source ArraySet. |
| public boolean | add(final T element)
Implements java. Adds the specified element to this set if it is not already present (optional operation). |
| public final boolean | Returns: true, if at least one element was added to the set and, as result, the size of the set was increased, or false, all element(s) was/were present in the set and, as the result, the set values were just reset.the elements to add. elements)Add the element(s) to the set. |
| public boolean | addAll(Collection<? extends T> collection)
Implements java. Adds all of the elements in the specified collection to this set if they're not already present (optional operation). |
| public void | |
| public boolean | contains(Object o)
Implements java. Returns |
| public boolean | containsAll(Collection<?> collection)
Implements java. Returns |
| public final T[] | |
| public final T[] | Returns: the copy of the underlying array. If the underlying array is null - then null will be returned.Get the copy of the underlying array. |
| public boolean | |
| public Iterator | |
| public final T[] | Returns: the copy of the underlying array. If the underlying array is null - then empty array will be returned.Get the copy of the underlying array. |
| public boolean | remove(Object o)
Implements java. Removes the specified element from this set if it is present (optional operation). |
| public final boolean | |
| public boolean | removeAll(Collection<?> collection)
Implements java. Removes from this set all of its elements that are contained in the specified collection (optional operation). |
| public boolean | retainAll(final Collection<?> collection)
Implements java. Retains only the elements in this set that are contained in the specified collection (optional operation). |
| public int | |
| public Object[] | toArray()
Implements java. Returns an array containing all of the elements in this set. |
| public <K> K[] | toArray(K[] a)
Implements java. Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. |
| array | back to summary |
|---|---|
| private volatile T[] array | |
| clazz | back to summary |
|---|---|
| private final Class<T> clazz | |
| replaceElementIfEquals | back to summary |
|---|---|
| private final boolean replaceElementIfEquals | |
| sync | back to summary |
|---|---|
| private final Object sync | |
| ArraySet | back to summary |
|---|---|
public ArraySet(final Class<T> clazz)
| |
| ArraySet | back to summary |
|---|---|
public ArraySet(final Class<T> clazz, final boolean replaceElementIfEquals)
| |
| add | back to summary |
|---|---|
| public final boolean add(ArraySet<T> source) Implements java. Add all the elements from the source ArraySet.
| |
| add | back to summary |
|---|---|
| public boolean add(final T element) Implements java. Doc from java. Adds the specified element to this set if it is not already present
(optional operation). More formally, adds the specified element
The stipulation above does not imply that sets must accept all
elements; sets may refuse to add any particular element, including
| |
| addAll | back to summary |
|---|---|
| public final boolean addAll(final T... elements) Add the element(s) to the set.
| |
| addAll | back to summary |
|---|---|
| public boolean addAll(Collection<? extends T> collection) Implements java. Doc from java. Adds all of the elements in the specified collection to this set if
they're not already present (optional operation). If the specified
collection is also a set, the
| |
| clear | back to summary |
|---|---|
| public void clear() Implements java. Remove all the set elements.
| |
| contains | back to summary |
|---|---|
| public boolean contains(Object o) Implements java. Doc from java. Returns
| |
| containsAll | back to summary |
|---|---|
| public boolean containsAll(Collection<?> collection) Implements java. Doc from java. Returns
| |
| getArray | back to summary |
|---|---|
| public final T[] getArray() Get the underlying array. Please note, it's not appropriate to modify the returned array's content. Please use
| |
| getArrayCopy | back to summary |
|---|---|
| public final T[] getArrayCopy() Get the copy of the underlying array. If the underlying array is null - then null will be returned.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements java. Doc from java. Returns
| |
| iterator | back to summary |
|---|---|
| public Iterator Implements java. Doc from java. Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).
| |
| obtainArrayCopy | back to summary |
|---|---|
| public final T[] obtainArrayCopy() Get the copy of the underlying array. If the underlying array is null - then empty array will be returned.
| |
| remove | back to summary |
|---|---|
| public boolean remove(Object o) Implements java. Doc from java. Removes the specified element from this set if it is present
(optional operation). More formally, removes an element
| |
| removeAll | back to summary |
|---|---|
| public final boolean removeAll(Object... elements) Remove element(s) from the set.
| |
| removeAll | back to summary |
|---|---|
| public boolean removeAll(Collection<?> collection) Implements java. Doc from java. Removes from this set all of its elements that are contained in the specified collection (optional operation). If the specified collection is also a set, this operation effectively modifies this set so that its value is the asymmetric set difference of the two sets.
| |
| retainAll | back to summary |
|---|---|
| public boolean retainAll(final Collection<?> collection) Implements java. Doc from java. Retains only the elements in this set that are contained in the specified collection (optional operation). In other words, removes from this set all of its elements that are not contained in the specified collection. If the specified collection is also a set, this operation effectively modifies this set so that its value is the intersection of the two sets.
| |
| size | back to summary |
|---|---|
| public int size() Implements java. Doc from java. Returns the number of elements in this set (its cardinality). If this
set contains more than
| |
| toArray | back to summary |
|---|---|
| public Object[] toArray() Implements java. Doc from java. Returns an array containing all of the elements in this set. If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. The returned array will be "safe" in that no references to it are maintained by this set. (In other words, this method must allocate a new array even if this set is backed by an array). The caller is thus free to modify the returned array. This method acts as bridge between array-based and collection-based APIs.
| |
| toArray | back to summary |
|---|---|
| public <K> K[] toArray(K[] a) Implements java. Doc from java. Returns an array containing all of the elements in this set; the runtime type of the returned array is that of the specified array. If the set fits in the specified array, it is returned therein. Otherwise, a new array is allocated with the runtime type of the specified array and the size of this set. If this set fits in the specified array with room to spare
(i.e., the array has more elements than this set), the element in
the array immediately following the end of the set is set to
If this set makes any guarantees as to what order its elements are returned by its iterator, this method must return the elements in the same order. Like the Suppose
String[] y = x.toArray(new String[0]);
Note that toArray(new Object[0]) is identical in function to
toArray().
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv int | |
| pack-priv T | |
| pack-priv T |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public boolean | |
| public T | |
| public void | remove()
Overrides default java. Removes from the underlying collection the last element returned by this iterator (optional operation). |
| cursor | back to summary |
|---|---|
| pack-priv int cursor | |
| lastRet | back to summary |
|---|---|
| pack-priv T lastRet | |
| nextElem | back to summary |
|---|---|
| pack-priv T nextElem | |
| Itr | back to summary |
|---|---|
| public Itr() | |
| advance | back to summary |
|---|---|
private void advance()
| |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public T next() Implements java. Doc from java. Returns the next element in the iteration.
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the
| |