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
ConstructorDescriptionDefault constructor.AnnotationMirrorSet
(Collection<? extends AnnotationMirror> values) -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(AnnotationMirror annotationMirror) boolean
addAll
(Collection<? extends AnnotationMirror> c) void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
isEmpty()
iterator()
boolean
boolean
removeAll
(Collection<?> c) boolean
retainAll
(Collection<?> c) static AnnotationMirrorSet
singleElementSet
(AnnotationMirror value) Returns a newAnnotationMirrorSet
that containsvalue
.int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] a) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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:
size
in interfaceCollection<AnnotationMirror>
- Specified by:
size
in interfaceSet<AnnotationMirror>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<AnnotationMirror>
- Specified by:
isEmpty
in interfaceSet<AnnotationMirror>
-
contains
- Specified by:
contains
in interfaceCollection<AnnotationMirror>
- Specified by:
contains
in interfaceSet<AnnotationMirror>
-
iterator
- Specified by:
iterator
in interfaceCollection<AnnotationMirror>
- Specified by:
iterator
in interfaceIterable<AnnotationMirror>
- Specified by:
iterator
in interfaceSet<AnnotationMirror>
-
toArray
- Specified by:
toArray
in interfaceCollection<AnnotationMirror>
- Specified by:
toArray
in interfaceSet<AnnotationMirror>
-
toArray
public <T> T[] toArray(T[] a) - Specified by:
toArray
in interfaceCollection<AnnotationMirror>
- Specified by:
toArray
in interfaceSet<AnnotationMirror>
-
add
- Specified by:
add
in interfaceCollection<AnnotationMirror>
- Specified by:
add
in interfaceSet<AnnotationMirror>
-
remove
- Specified by:
remove
in interfaceCollection<AnnotationMirror>
- Specified by:
remove
in interfaceSet<AnnotationMirror>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<AnnotationMirror>
- Specified by:
containsAll
in interfaceSet<AnnotationMirror>
-
addAll
- Specified by:
addAll
in interfaceCollection<AnnotationMirror>
- Specified by:
addAll
in interfaceSet<AnnotationMirror>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<AnnotationMirror>
- Specified by:
retainAll
in interfaceSet<AnnotationMirror>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<AnnotationMirror>
- Specified by:
removeAll
in interfaceSet<AnnotationMirror>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<AnnotationMirror>
- Specified by:
clear
in interfaceSet<AnnotationMirror>
-
singleElementSet
Returns a newAnnotationMirrorSet
that containsvalue
.- Parameters:
value
- AnnotationMirror to put in the set- Returns:
- a new
AnnotationMirrorSet
that containsvalue
-
toString
-