Package org.intermine.util
Class ConsistentSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.intermine.util.ConsistentSet<E>
-
- Type Parameters:
E
- The element type
- All Implemented Interfaces:
java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.Set<E>
public class ConsistentSet<E> extends java.util.AbstractSet<E>
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.- Author:
- Andrew Varley
-
-
Constructor Summary
Constructors Constructor Description ConsistentSet()
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E obj)
Add an object to the set.boolean
addAll(java.util.Collection<? extends E> col)
Add a whole Collection of objects to the set.java.util.Iterator<E>
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.AbstractCollection
clear, contains, containsAll, isEmpty, remove, retainAll, toArray, toArray, toString
-
-
-
-
Method Detail
-
add
public boolean add(E obj)
Add an object to the set. If an equivalent object already exists, nothing happens.
-
addAll
public boolean addAll(java.util.Collection<? extends E> col)
Add a whole Collection of objects to the set.
-
size
public int size()
Return the number of elements in this Set.
-
iterator
public java.util.Iterator<E> iterator()
Return an iterator for the elements in the Set.
-
-