DthingApi
|
Public Member Functions | |
boolean | add (E object) |
boolean | addAll (Collection<? extends E > collection) |
void | clear () |
boolean | contains (Object object) |
boolean | containsAll (Collection<?> collection) |
boolean | isEmpty () |
abstract Iterator< E > | iterator () |
boolean | remove (Object object) |
boolean | removeAll (Collection<?> collection) |
boolean | retainAll (Collection<?> collection) |
abstract int | size () |
Object [] | toArray () |
String | toString () |
![]() | |
boolean | equals (Object object) |
int | hashCode () |
Protected Member Functions | |
AbstractCollection () | |
Class
is an abstract implementation of the
interface. A subclass must implement the abstract methods
and
to create an immutable collection. To create a modifiable collection it's necessary to override the
method that currently throws an
.
|
inlineprotected |
Constructs a new instance of this AbstractCollection.
|
inline |
Attempts to add
to the contents of this
(optional).
After this method finishes successfully it is guaranteed that the object is contained in the collection.
If the collection was modified it returns
,
if no changes were made.
An implementation of
may narrow the set of accepted objects, but it has to specify this in the documentation. If the object to be added does not meet this restriction, then an
is thrown.
If a collection does not yet contain an object that is to be added and adding the object fails, this method must throw an appropriate unchecked Exception. Returning false is not permitted in this case because it would violate the postcondition that the element will be part of the collection after this method finishes.
object | the object to add. |
UnsupportedOperationException | if adding to this Collection |
ClassCastException | if the class of the object is inappropriate for this collection. |
IllegalArgumentException | if the object cannot be added to this Collection |
NullPointerException | if null elements cannot be added to the Collection |
Implements java.util.Collection< E >.
|
inline |
Attempts to add all of the objects contained in
to the contents of this
(optional). This implementation iterates over the given
and calls
for each element. If any of these calls return
, then
is returned as result of this method call,
otherwise. If this
does not support adding elements, an
is thrown.
If the passed
is changed during the process of adding elements to this
, the behavior depends on the behavior of the passed
.
collection | the collection of objects. |
UnsupportedOperationException | if adding to this Collection |
ClassCastException | if the class of an object is inappropriate for this Collection |
IllegalArgumentException | if an object cannot be added to this Collection |
NullPointerException | if collection null null Collection |
Implements java.util.Collection< E >.
|
inline |
Removes all elements from this
, leaving it empty (optional). This implementation iterates over this
and calls the
method on each element. If the iterator does not support removal of elements, an
is thrown.
Concrete implementations usually can clear a
more efficiently and should therefore overwrite this method.
UnsupportedOperationException | it the iterator does not support removing elements from this Collection |
Implements java.util.Collection< E >.
|
inline |
Tests whether this
contains the specified object. This implementation iterates over this
and tests, whether any element is equal to the given object. If
then
is called for each element
returned by the iterator until the element is found. If
then each element
returned by the iterator is compared with the test
.
object | the object to search for. |
ClassCastException | if the object to look for isn't of the correct type. |
NullPointerException | if the object to look for is null Collection null |
Implements java.util.Collection< E >.
|
inline |
Tests whether this
contains all objects contained in the specified
. This implementation iterates over the specified
. If one element returned by the iterator is not contained in this
, then
is returned;
otherwise.
collection | the collection of objects. |
ClassCastException | if one or more elements of collection |
NullPointerException | if collection null Collection null |
NullPointerException | if collection null |
Implements java.util.Collection< E >.
|
inline |
Returns if this
contains no elements. This implementation tests, whether
returns 0.
Implements java.util.Collection< E >.
|
abstract |
Returns an instance of Iterator that may be used to access the objects contained by this
. The order in which the elements are returned by the Iterator is not defined unless the instance of the
has a defined order. In that case, the elements are returned in that order.
In this class this method is declared abstract and has to be implemented by concrete
implementations.
Implements java.util.Collection< E >.
|
inline |
Removes one instance of the specified object from this
if one is contained (optional). This implementation iterates over this
and tests for each element
returned by the iterator, whether
is equal to the given object. If
then this test is performed using
, otherwise using
. If an element equal to the given object is found, then the
method is called on the iterator and
is returned,
otherwise. If the iterator does not support removing elements, an
is thrown.
object | the object to remove. |
UnsupportedOperationException | if removing from this Collection |
ClassCastException | if the object passed is not of the correct type. |
NullPointerException | if object null Collection null |
Implements java.util.Collection< E >.
|
inline |
Removes all occurrences in this
of each object in the specified
(optional). After this method returns none of the elements in the passed
can be found in this
anymore.
This implementation iterates over this
and tests for each element
returned by the iterator, whether it is contained in the specified
. If this test is positive, then the
method is called on the iterator. If the iterator does not support removing elements, an
is thrown.
collection | the collection of objects to remove. |
UnsupportedOperationException | if removing from this Collection |
ClassCastException | if one or more elements of collection |
NullPointerException | if collection null Collection null |
NullPointerException | if collection null |
Implements java.util.Collection< E >.
|
inline |
Removes all objects from this
that are not also found in the
passed (optional). After this method returns this
will only contain elements that also can be found in the
passed to this method.
This implementation iterates over this
and tests for each element
returned by the iterator, whether it is contained in the specified
. If this test is negative, then the
method is called on the iterator. If the iterator does not support removing elements, an
is thrown.
collection | the collection of objects to retain. |
UnsupportedOperationException | if removing from this Collection |
ClassCastException | if one or more elements of collection |
NullPointerException | if collection null Collection null |
NullPointerException | if collection null |
Implements java.util.Collection< E >.
|
abstract |
Returns a count of how many objects this
contains.
In this class this method is declared abstract and has to be implemented by concrete
implementations.
Implements java.util.Collection< E >.
|
inline |
Returns a new array containing all elements contained in this
.
If the implementation has ordered elements it will return the element array in the same order as an iterator would return them.
The array returned does not reflect any changes of the
. A new array is created even if the underlying data structure is already an array.
Implements java.util.Collection< E >.
|
inline |
Returns the string representation of this
. The presentation has a specific format. It is enclosed by square brackets ("[]"). Elements are separated by ', ' (comma and space).