org.intermine.util
Class ConsistentSet

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet
          extended by org.intermine.util.ConsistentSet
All Implemented Interfaces:
java.lang.Iterable, java.util.Collection, java.util.Set

public class ConsistentSet
extends java.util.AbstractSet

A Set that allows for its member objects to be changed whilst still belonging to the set. Normally, this would result in unspecified behavior, as the hashCode() for the objects may change once added. If elements are changed so that two elements are made equal, behaviour is unspecified.


Constructor Summary
ConsistentSet()
          Constructor.
 
Method Summary
 boolean add(java.lang.Object obj)
          Add an object to the set.
 boolean addAll(java.util.Collection col)
          Add a whole Collection of objects to the set.
 java.util.Iterator iterator()
          Return an iterator for the elements in the Set.
 int size()
          Return the number of elements in this Set.
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray
 

Constructor Detail

ConsistentSet

public ConsistentSet()
Constructor.

Method Detail

add

public boolean add(java.lang.Object obj)
Add an object to the set. If an equivalent object already exists, nothing happens.

Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Overrides:
add in class java.util.AbstractCollection
Parameters:
obj - the object to be added
Returns:
true if the set was altered
See Also:
Set#add

addAll

public boolean addAll(java.util.Collection col)
Add a whole Collection of objects to the set.

Specified by:
addAll in interface java.util.Collection
Specified by:
addAll in interface java.util.Set
Overrides:
addAll in class java.util.AbstractCollection
Parameters:
col - the Collection of objects to be added
Returns:
true if the set was altered
See Also:
Set#addAll

size

public int size()
Return the number of elements in this Set.

Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.Set
Specified by:
size in class java.util.AbstractCollection
Returns:
the number of elements in the Set.

iterator

public java.util.Iterator iterator()
Return an iterator for the elements in the Set.

Specified by:
iterator in interface java.lang.Iterable
Specified by:
iterator in interface java.util.Collection
Specified by:
iterator in interface java.util.Set
Specified by:
iterator in class java.util.AbstractCollection
Returns:
an iterator