Package org.castor.core.util
Class IdentitySet
java.lang.Object
org.castor.core.util.IdentitySet
- All Implemented Interfaces:
Iterable
,Collection
,Set
An IdentitySet that uses reference-equality instead of object-equality. According
to its special function it violates some design contracts of the
Set
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 -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a set with default capacity.IdentitySet
(int capacity) Construct a set with given capacity. -
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
addAll
(Collection c) This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.void
clear()
boolean
boolean
In contrast with the design contract of theSet
interface this method has not been implemented and throws aUnsupportedOperationException
.boolean
isEmpty()
iterator()
boolean
boolean
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.boolean
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.int
size()
Object[]
toArray()
Object[]
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
equals, hashCode, spliterator
-
Constructor Details
-
IdentitySet
public IdentitySet()Construct a set with default capacity. -
IdentitySet
public IdentitySet(int capacity) Construct a set with given capacity.- Parameters:
capacity
- The capacity of entries this set should be initialized with.
-
-
Method Details
-
clear
public void clear()- Specified by:
clear
in interfaceCollection
- Specified by:
clear
in interfaceSet
- See Also:
-
size
public int size()- Specified by:
size
in interfaceCollection
- Specified by:
size
in interfaceSet
- See Also:
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection
- Specified by:
isEmpty
in interfaceSet
- See Also:
-
add
- Specified by:
add
in interfaceCollection
- Specified by:
add
in interfaceSet
- See Also:
-
contains
- Specified by:
contains
in interfaceCollection
- Specified by:
contains
in interfaceSet
- See Also:
-
remove
- Specified by:
remove
in interfaceCollection
- Specified by:
remove
in interfaceSet
- See Also:
-
iterator
-
toArray
- Specified by:
toArray
in interfaceCollection
- Specified by:
toArray
in interfaceSet
- See Also:
-
toArray
- Specified by:
toArray
in interfaceCollection
- Specified by:
toArray
in interfaceSet
- See Also:
-
containsAll
In contrast with the design contract of theSet
interface this method has not been implemented and throws aUnsupportedOperationException
.- Specified by:
containsAll
in interfaceCollection
- Specified by:
containsAll
in interfaceSet
- See Also:
-
addAll
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.- Specified by:
addAll
in interfaceCollection
- Specified by:
addAll
in interfaceSet
- See Also:
-
removeAll
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.- Specified by:
removeAll
in interfaceCollection
- Specified by:
removeAll
in interfaceSet
- See Also:
-
retainAll
This optional method has not been implemented forIdentitySet
instead it throws aUnsupportedOperationException
as defined in theSet
interface.- Specified by:
retainAll
in interfaceCollection
- Specified by:
retainAll
in interfaceSet
- See Also:
-