Package org.castor.core.util
Class IdentitySet
- java.lang.Object
-
- org.castor.core.util.IdentitySet
-
- All Implemented Interfaces:
java.lang.Iterable
,java.util.Collection
,java.util.Set
public final class IdentitySet extends java.lang.Object implements java.util.Set
An IdentitySet that uses reference-equality instead of object-equality. According to its special function it violates some design contracts of theSet
interface.- Since:
- 0.9.9
- Version:
- $Revision: 7491 $ $Date: 2006-04-13 10:49:49 -0600 (Thu, 13 Apr 2006) $
- Author:
- Ralf Joachim
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
IdentitySet.Entry
An entry of theIdentitySet
.
-
Constructor Summary
Constructors Constructor Description IdentitySet()
Construct a set with default capacity.IdentitySet(int capacity)
Construct a set with given capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(java.lang.Object key)
boolean
addAll(java.util.Collection c)
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.void
clear()
boolean
contains(java.lang.Object key)
boolean
containsAll(java.util.Collection c)
In contrast with the design contract of theSet
interface this method has not been implemented and throws aUnsupportedOperationException
.boolean
isEmpty()
java.util.Iterator
iterator()
boolean
remove(java.lang.Object key)
boolean
removeAll(java.util.Collection c)
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.boolean
retainAll(java.util.Collection c)
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.int
size()
java.lang.Object[]
toArray()
java.lang.Object[]
toArray(java.lang.Object[] a)
-
-
-
Method Detail
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection
- Specified by:
clear
in interfacejava.util.Set
- See Also:
Collection.clear()
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection
- Specified by:
size
in interfacejava.util.Set
- See Also:
Collection.size()
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection
- Specified by:
isEmpty
in interfacejava.util.Set
- See Also:
Collection.isEmpty()
-
add
public boolean add(java.lang.Object key)
- Specified by:
add
in interfacejava.util.Collection
- Specified by:
add
in interfacejava.util.Set
- See Also:
Collection.add(java.lang.Object)
-
contains
public boolean contains(java.lang.Object key)
- Specified by:
contains
in interfacejava.util.Collection
- Specified by:
contains
in interfacejava.util.Set
- See Also:
Collection.contains(java.lang.Object)
-
remove
public boolean remove(java.lang.Object key)
- Specified by:
remove
in interfacejava.util.Collection
- Specified by:
remove
in interfacejava.util.Set
- See Also:
Collection.remove(java.lang.Object)
-
iterator
public java.util.Iterator iterator()
- Specified by:
iterator
in interfacejava.util.Collection
- Specified by:
iterator
in interfacejava.lang.Iterable
- Specified by:
iterator
in interfacejava.util.Set
- See Also:
Collection.iterator()
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection
- Specified by:
toArray
in interfacejava.util.Set
- See Also:
Collection.toArray()
-
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
- Specified by:
toArray
in interfacejava.util.Collection
- Specified by:
toArray
in interfacejava.util.Set
- See Also:
Collection.toArray(java.lang.Object[])
-
containsAll
public boolean containsAll(java.util.Collection c)
In contrast with the design contract of theSet
interface this method has not been implemented and throws aUnsupportedOperationException
.- Specified by:
containsAll
in interfacejava.util.Collection
- Specified by:
containsAll
in interfacejava.util.Set
- See Also:
Set.containsAll(java.util.Collection<?>)
-
addAll
public boolean addAll(java.util.Collection c)
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.- Specified by:
addAll
in interfacejava.util.Collection
- Specified by:
addAll
in interfacejava.util.Set
- See Also:
Set.addAll(java.util.Collection<? extends E>)
-
removeAll
public boolean removeAll(java.util.Collection c)
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.- Specified by:
removeAll
in interfacejava.util.Collection
- Specified by:
removeAll
in interfacejava.util.Set
- See Also:
Set.removeAll(java.util.Collection<?>)
-
retainAll
public boolean retainAll(java.util.Collection c)
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.- Specified by:
retainAll
in interfacejava.util.Collection
- Specified by:
retainAll
in interfacejava.util.Set
- See Also:
Set.retainAll(java.util.Collection<?>)
-
-