org.castor.core.util
Class IdentitySet

java.lang.Object
  extended by org.castor.core.util.IdentitySet
All Implemented Interfaces:
Iterable, Collection, Set

public final class IdentitySet
extends Object
implements 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
 class IdentitySet.Entry
          An entry of the IdentitySet.
 
Constructor Summary
IdentitySet()
          Construct a set with default capacity.
IdentitySet(int capacity)
          Construct a set with given capacity.
 
Method Summary
 boolean add(Object key)
          
 boolean addAll(Collection c)
          This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.
 void clear()
          
 boolean contains(Object key)
          
 boolean containsAll(Collection c)
          In contrast with the design contract of the Set interface this method has not been implemented and throws a UnsupportedOperationException.
 boolean isEmpty()
          
 Iterator iterator()
          
 boolean remove(Object key)
          
 boolean removeAll(Collection c)
          This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.
 boolean retainAll(Collection c)
          This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.
 int size()
          
 Object[] toArray()
          
 Object[] toArray(Object[] a)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

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 Detail

clear

public void clear()

Specified by:
clear in interface Collection
Specified by:
clear in interface Set
See Also:
Collection.clear()

size

public int size()

Specified by:
size in interface Collection
Specified by:
size in interface Set
See Also:
Collection.size()

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Collection
Specified by:
isEmpty in interface Set
See Also:
Collection.isEmpty()

add

public boolean add(Object key)

Specified by:
add in interface Collection
Specified by:
add in interface Set
See Also:
Collection.add(java.lang.Object)

contains

public boolean contains(Object key)

Specified by:
contains in interface Collection
Specified by:
contains in interface Set
See Also:
Collection.contains(java.lang.Object)

remove

public boolean remove(Object key)

Specified by:
remove in interface Collection
Specified by:
remove in interface Set
See Also:
Collection.remove(java.lang.Object)

iterator

public Iterator iterator()

Specified by:
iterator in interface Iterable
Specified by:
iterator in interface Collection
Specified by:
iterator in interface Set
See Also:
Collection.iterator()

toArray

public Object[] toArray()

Specified by:
toArray in interface Collection
Specified by:
toArray in interface Set
See Also:
Collection.toArray()

toArray

public Object[] toArray(Object[] a)

Specified by:
toArray in interface Collection
Specified by:
toArray in interface Set
See Also:
Collection.toArray(java.lang.Object[])

containsAll

public boolean containsAll(Collection c)
In contrast with the design contract of the Set interface this method has not been implemented and throws a UnsupportedOperationException.

Specified by:
containsAll in interface Collection
Specified by:
containsAll in interface Set
See Also:
Set.containsAll(java.util.Collection)

addAll

public boolean addAll(Collection c)
This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.

Specified by:
addAll in interface Collection
Specified by:
addAll in interface Set
See Also:
Set.addAll(java.util.Collection)

removeAll

public boolean removeAll(Collection c)
This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.

Specified by:
removeAll in interface Collection
Specified by:
removeAll in interface Set
See Also:
Set.removeAll(java.util.Collection)

retainAll

public boolean retainAll(Collection c)
This optional method has not been implemented for IdentitySet instead it throws a UnsupportedOperationException as defined in the Set interface.

Specified by:
retainAll in interface Collection
Specified by:
retainAll in interface Set
See Also:
Set.retainAll(java.util.Collection)


Copyright © 2012. All Rights Reserved.