public class CheckedCollection
extends java.lang.Object
implements java.util.Collection, java.util.Set
Modifier and Type | Field and Description |
---|---|
protected java.util.Collection |
coll
The collection.
|
protected java.lang.Exception |
lastmod
The last modification.
|
protected CheckedMap |
parent
The paretn map (if any).
|
Constructor and Description |
---|
CheckedCollection(java.util.Collection coll)
Create a new collection.
|
CheckedCollection(java.util.Collection coll,
CheckedMap parent)
Create a new collection.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(java.lang.Object o)
Ensures that this collection contains the specified element (optional
operation).
|
boolean |
addAll(java.util.Collection c)
Adds all of the elements in the specified collection to this collection
(optional operation).
|
void |
clear()
Removes all of the elements from this collection (optional operation).
|
boolean |
contains(java.lang.Object o)
Returns
|
boolean |
containsAll(java.util.Collection c)
Returns
|
boolean |
equals(java.lang.Object o)
Compares the specified object with this collection for equality.
|
int |
hashCode()
Returns the hash code value for this collection.
|
boolean |
isEmpty()
Returns
|
java.util.Iterator |
iterator()
Returns an iterator over the elements in this collection.
|
boolean |
remove(java.lang.Object o)
Removes a single instance of the specified element from this
collection, if it is present (optional operation).
|
boolean |
removeAll(java.util.Collection c)
Removes all of this collection's elements that are also contained in the
specified collection (optional operation).
|
boolean |
retainAll(java.util.Collection c)
Retains only the elements in this collection that are contained in the
specified collection (optional operation).
|
int |
size()
Returns the number of elements in this collection.
|
java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this collection.
|
java.lang.Object[] |
toArray(java.lang.Object[] 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.
|
protected java.util.Collection coll
protected java.lang.Exception lastmod
protected CheckedMap parent
public CheckedCollection(java.util.Collection coll)
public CheckedCollection(java.util.Collection coll, CheckedMap parent)
public int size()
size
in interface java.util.Collection
size
in interface java.util.Set
public boolean isEmpty()
isEmpty
in interface java.util.Collection
isEmpty
in interface java.util.Set
public boolean contains(java.lang.Object o)
contains
in interface java.util.Collection
contains
in interface java.util.Set
o
- element whose presence in this collection is to be testedjava.lang.ClassCastException
- if the type of the specified element
is incompatible with this collection (optional)java.lang.NullPointerException
- if the specified element is null and this
collection does not permit null elements (optional)public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in interface java.util.Set
public java.lang.Object[] toArray()
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
public java.lang.Object[] toArray(java.lang.Object[] a)
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.
toArray
in interface java.util.Collection
toArray
in interface java.util.Set
a
- 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.java.lang.ArrayStoreException
- if the runtime type of the specified array
is not a supertype of the runtime type of every element in
this collectionjava.lang.NullPointerException
- if the specified array is nullpublic boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in interface java.util.Set
e
- element whose presence in this collection is to be ensuredjava.lang.UnsupportedOperationException
- if the
java.lang.ClassCastException
- if the class of the specified element
prevents it from being added to this collectionjava.lang.NullPointerException
- if the specified element is null and this
collection does not permit null elementsjava.lang.IllegalArgumentException
- if some property of the element
prevents it from being added to this collectionjava.lang.IllegalStateException
- if the element cannot be added at this
time due to insertion restrictionspublic boolean remove(java.lang.Object o)
remove
in interface java.util.Collection
remove
in interface java.util.Set
o
- element to be removed from this collection, if presentjava.lang.ClassCastException
- if the type of the specified element
is incompatible with this collection (optional)java.lang.NullPointerException
- if the specified element is null and this
collection does not permit null elements (optional)java.lang.UnsupportedOperationException
- if the
public boolean containsAll(java.util.Collection c)
containsAll
in interface java.util.Collection
containsAll
in interface java.util.Set
c
- collection to be checked for containment in this collectionjava.lang.ClassCastException
- if the types of one or more elements
in the specified collection are incompatible with this
collection (optional)java.lang.NullPointerException
- if the specified collection contains one
or more null elements and this collection does not permit null
elements (optional), or if the specified collection is nullcontains(Object)
public boolean addAll(java.util.Collection c)
addAll
in interface java.util.Collection
addAll
in interface java.util.Set
c
- collection containing elements to be added to this collectionjava.lang.UnsupportedOperationException
- if the
java.lang.ClassCastException
- if the class of an element of the specified
collection prevents it from being added to this collectionjava.lang.NullPointerException
- if the specified collection contains a
null element and this collection does not permit null elements,
or if the specified collection is nulljava.lang.IllegalArgumentException
- if some property of an element of the
specified collection prevents it from being added to this
collectionjava.lang.IllegalStateException
- if not all the elements can be added at
this time due to insertion restrictionsadd(Object)
public boolean removeAll(java.util.Collection c)
removeAll
in interface java.util.Collection
removeAll
in interface java.util.Set
c
- collection containing elements to be removed from this collectionjava.lang.UnsupportedOperationException
- if the
java.lang.ClassCastException
- if the types of one or more elements
in this collection are incompatible with the specified
collection (optional)java.lang.NullPointerException
- if this collection contains one or more
null elements and the specified collection does not support
null elements (optional), or if the specified collection is nullremove(Object)
,
contains(Object)
public boolean retainAll(java.util.Collection c)
retainAll
in interface java.util.Collection
retainAll
in interface java.util.Set
c
- collection containing elements to be retained in this collectionjava.lang.UnsupportedOperationException
- if the
java.lang.ClassCastException
- if the types of one or more elements
in this collection are incompatible with the specified
collection (optional)java.lang.NullPointerException
- if this collection contains one or more
null elements and the specified collection does not permit null
elements (optional), or if the specified collection is nullremove(Object)
,
contains(Object)
public void clear()
clear
in interface java.util.Collection
clear
in interface java.util.Set
java.lang.UnsupportedOperationException
- if the
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection
equals
in interface java.util.Set
equals
in class java.lang.Object
o
- object to be compared for equality with this collectionObject.equals(Object)
,
Set.equals(Object)
,
List.equals(Object)
public int hashCode()
hashCode
in interface java.util.Collection
hashCode
in interface java.util.Set
hashCode
in class java.lang.Object
Object.hashCode()
,
Object.equals(Object)