Class IdentitySet<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.soliscode.test.util.IdentitySet<E>
- Type Parameters:
E
- the element type.
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Set<E>
An Set that checks for elements by identity rather han by equality. This class is used to implement
assertions that are checking for element identity.
- Since:
- 1.0
- Author:
- evanbergstrom
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty identity set.IdentitySet
(@NotNull Collection<? extends E> c) Creates a copy of another identity set. -
Method Summary
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, 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.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface java.util.Set
addAll, clear, containsAll, isEmpty, retainAll, spliterator, toArray, toArray
-
Constructor Details
-
IdentitySet
public IdentitySet()Creates an empty identity set. -
IdentitySet
Creates a copy of another identity set.- Parameters:
c
- the identity set to copy.
-
-
Method Details
-
size
public int size()- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
iterator
-
contains
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
add
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceSet<E>
- Overrides:
add
in classAbstractCollection<E>
-
remove
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceSet<E>
- Overrides:
remove
in classAbstractCollection<E>
-