public class ScreenOverlayCollectionBase extends Object implements Collection<ScreenOverlay>, Iterable<ScreenOverlay>, IDisposable
ScreenOverlay
and by ScreenOverlayManager
.Modifier and Type | Method and Description |
---|---|
boolean |
add(ScreenOverlay item)
Adds an overlay to the collection.
|
boolean |
addAll(Collection<? extends ScreenOverlay> c)
Adds all of the elements in the specified collection to this collection
(optional operation).
|
void |
clear()
Removes all overlays from the collection.
|
boolean |
contains(Object item)
Determines whether the collection contains a specific overlay.
|
boolean |
containsAll(Collection<?> c)
Returns true if this collection contains all of the elements
in the specified collection.
|
void |
copyTo(ScreenOverlay[] toArray,
int startingIndex) |
void |
dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting
unmanaged resources.
|
protected void |
dispose(boolean disposing) |
protected void |
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
ScreenOverlay |
get(int index)
Gets the overlay at the specified index.
|
boolean |
getIsReadOnly()
Gets a value indicating whether the collection is read-only.
|
boolean |
isEmpty()
Returns true if this collection contains no elements.
|
Iterator<ScreenOverlay> |
iterator()
Returns an enumerator that iterates through the collection.
|
boolean |
remove(Object item)
Removes the first occurrence of a specific overlay from the collection.
|
boolean |
removeAll(Collection<?> c)
Removes all of this collection's elements that are also contained in the
specified collection (optional operation).
|
boolean |
retainAll(Collection<?> c)
Retains only the elements in this collection that are contained in the
specified collection (optional operation).
|
int |
size()
Gets the number of screen overlays in the collection.
|
Object[] |
toArray()
Returns an array containing all of the elements in this collection.
|
<T> T[] |
toArray(T[] a)
Returns an array containing all of the elements in this collection;
the runtime type of the returned array is that of the specified array.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, parallelStream, removeIf, spliterator, stream
close
protected void finalize() throws Throwable
java.lang.Object
finalize
method to dispose of
system resources or to perform other cleanup.
The general contract of finalize
is that it is invoked
if and when the Java™ virtual
machine has determined that there is no longer any
means by which this object can be accessed by any thread that has
not yet died, except as a result of an action taken by the
finalization of some other object or class which is ready to be
finalized. The finalize
method may take any action, including
making this object available again to other threads; the usual purpose
of finalize
, however, is to perform cleanup actions before
the object is irrevocably discarded. For example, the finalize method
for an object that represents an input/output connection might perform
explicit I/O transactions to break the connection before the object is
permanently discarded.
The finalize
method of class Object
performs no
special action; it simply returns normally. Subclasses of
Object
may override this definition.
The Java programming language does not guarantee which thread will
invoke the finalize
method for any given object. It is
guaranteed, however, that the thread that invokes finalize will not
be holding any user-visible synchronization locks when finalize is
invoked. If an uncaught exception is thrown by the finalize method,
the exception is ignored and finalization of that object terminates.
After the finalize
method has been invoked for an object, no
further action is taken until the Java virtual machine has again
determined that there is no longer any means by which this object can
be accessed by any thread that has not yet died, including possible
actions by other objects or classes which are ready to be finalized,
at which point the object may be discarded.
The finalize
method is never invoked more than once by a Java
virtual machine for any given object.
Any exception thrown by the finalize
method causes
the finalization of this object to be halted, but is otherwise
ignored.
finalize
in class Object
Throwable
- the Exception
raised by this methodWeakReference
,
PhantomReference
public final void dispose()
IDisposable
dispose
in interface IDisposable
protected void dispose(boolean disposing)
public boolean getIsReadOnly()
public ScreenOverlay get(int index)
index
- The zero-based index of the overlay to get.ArgumentOutOfRangeException
- index
is not a valid index in the collection.public Iterator<ScreenOverlay> iterator()
iterator
in interface Iterable<ScreenOverlay>
iterator
in interface Collection<ScreenOverlay>
public boolean contains(Object item)
contains
in interface Collection<ScreenOverlay>
item
- The overlay to locate in the collection.true
if the item is found in the collection; otherwise false
.public boolean remove(Object item)
remove
in interface Collection<ScreenOverlay>
item
- The overlay to remove from the collection.true
if item
was successfully removed from the collection;
otherwise false
. This method also returns false
if
item
is not found in the original collection.public void clear()
clear
in interface Collection<ScreenOverlay>
public boolean add(ScreenOverlay item)
add
in interface Collection<ScreenOverlay>
item
- The overlay to add to the collection.public int size()
size
in interface Collection<ScreenOverlay>
public boolean isEmpty()
java.util.Collection
isEmpty
in interface Collection<ScreenOverlay>
public Object[] toArray()
java.util.Collection
The returned array will be "safe" in that no references to it are maintained by this collection. (In other words, this method must allocate a new array even if this collection 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
in interface Collection<ScreenOverlay>
public <T> T[] toArray(T[] a)
java.util.Collection
If this collection fits in the specified array with room to spare (i.e., the array has more elements than this collection), the element in the array immediately following the end of the collection is set to null. (This is useful in determining the length of this collection only if the caller knows that this collection does not contain any null elements.)
If this collection 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 Collection.toArray()
method, this method acts as bridge between
array-based and collection-based APIs. Further, this method allows
precise control over the runtime type of the output array, and may,
under certain circumstances, be used to save allocation costs.
Suppose x is a collection known to contain only strings. The following code can be used to dump the collection into a newly allocated array of String:
String[] y = x.toArray(new String[0]);Note that toArray(new Object[0]) is identical in function to toArray().
toArray
in interface Collection<ScreenOverlay>
T
- the runtime type of the array to contain the collectiona
- the array into which the elements of this collection are to be
stored, if it is big enough; otherwise, a new array of the same
runtime type is allocated for this purpose.public boolean addAll(Collection<? extends ScreenOverlay> c)
java.util.Collection
addAll
in interface Collection<ScreenOverlay>
c
- collection containing elements to be added to this collectionCollection.add(Object)
public boolean removeAll(Collection<?> c)
java.util.Collection
removeAll
in interface Collection<ScreenOverlay>
c
- collection containing elements to be removed from this collectionCollection.remove(Object)
,
Collection.contains(Object)
public boolean retainAll(Collection<?> c)
java.util.Collection
retainAll
in interface Collection<ScreenOverlay>
c
- collection containing elements to be retained in this collectionCollection.remove(Object)
,
Collection.contains(Object)
public boolean containsAll(Collection<?> c)
java.util.Collection
containsAll
in interface Collection<ScreenOverlay>
c
- collection to be checked for containment in this collectionCollection.contains(Object)
public void copyTo(ScreenOverlay[] toArray, int startingIndex)