Class AnnotationMirrorSet
java.lang.Object
org.checkerframework.framework.util.AnnotationMirrorSet
- All Implemented Interfaces:
Iterable<AnnotationMirror>,Collection<AnnotationMirror>,Set<AnnotationMirror>
The Set interface defines many methods with respect to the equals method. This implementation of
Set violates those specifications, but fulfills the same property using
AnnotationUtils.areSame(javax.lang.model.element.AnnotationMirror, javax.lang.model.element.AnnotationMirror) rather than equals.
For example, the specification for the contains(Object o) method says: "returns true if and
only if this collection contains at least one element e such that (o == null ? e == null :
o.equals(e))." The specification for contains(java.lang.Object) is "returns true if and
only if this collection contains at least one element e such that (o == null ? e == null :
AnnotationUtils.areSame(o, e))".
AnnotationMirror is an interface and not all implementing classes provide a correct equals method; therefore, the existing implementations of Set cannot be used.
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.AnnotationMirrorSet(Collection<? extends AnnotationMirror> values) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(AnnotationMirror annotationMirror) booleanaddAll(Collection<? extends AnnotationMirror> c) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) static AnnotationMirrorSetsingleElementSet(AnnotationMirror value) Returns a newAnnotationMirrorSetthat containsvalue.intsize()Object[]toArray()<T> T[]toArray(T[] a) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
equals, hashCode, spliterator
-
Constructor Details
-
AnnotationMirrorSet
public AnnotationMirrorSet()Default constructor. -
AnnotationMirrorSet
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<AnnotationMirror>- Specified by:
sizein interfaceSet<AnnotationMirror>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<AnnotationMirror>- Specified by:
isEmptyin interfaceSet<AnnotationMirror>
-
contains
- Specified by:
containsin interfaceCollection<AnnotationMirror>- Specified by:
containsin interfaceSet<AnnotationMirror>
-
iterator
- Specified by:
iteratorin interfaceCollection<AnnotationMirror>- Specified by:
iteratorin interfaceIterable<AnnotationMirror>- Specified by:
iteratorin interfaceSet<AnnotationMirror>
-
toArray
- Specified by:
toArrayin interfaceCollection<AnnotationMirror>- Specified by:
toArrayin interfaceSet<AnnotationMirror>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArrayin interfaceCollection<AnnotationMirror>- Specified by:
toArrayin interfaceSet<AnnotationMirror>
-
add
- Specified by:
addin interfaceCollection<AnnotationMirror>- Specified by:
addin interfaceSet<AnnotationMirror>
-
remove
- Specified by:
removein interfaceCollection<AnnotationMirror>- Specified by:
removein interfaceSet<AnnotationMirror>
-
containsAll
- Specified by:
containsAllin interfaceCollection<AnnotationMirror>- Specified by:
containsAllin interfaceSet<AnnotationMirror>
-
addAll
- Specified by:
addAllin interfaceCollection<AnnotationMirror>- Specified by:
addAllin interfaceSet<AnnotationMirror>
-
retainAll
- Specified by:
retainAllin interfaceCollection<AnnotationMirror>- Specified by:
retainAllin interfaceSet<AnnotationMirror>
-
removeAll
- Specified by:
removeAllin interfaceCollection<AnnotationMirror>- Specified by:
removeAllin interfaceSet<AnnotationMirror>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<AnnotationMirror>- Specified by:
clearin interfaceSet<AnnotationMirror>
-
singleElementSet
Returns a newAnnotationMirrorSetthat containsvalue.- Parameters:
value- AnnotationMirror to put in the set- Returns:
- a new
AnnotationMirrorSetthat containsvalue
-
toString
-