Top Description Fields Constructors Methods
com.google.auto.value.processor

pack-priv Class TypeMirrorSet

extends java.util.AbstractSet<javax.lang.model.type.TypeMirror>
Class Inheritance
Imports
com.google.auto.common.MoreTypes, com.google.common.base.Equivalence, com.google.common.collect.ImmutableList, java.util.AbstractSet, .Collection, .Iterator, .LinkedHashSet, .Set, javax.lang.model.type.TypeMirror

A set of TypeMirror objects.
Author
[email protected] (Éamonn McManus)

Field Summary

Modifier and TypeField and Description
private final Set<Equivalence.Wrapper<javax.lang.model.type.TypeMirror>>

Constructor Summary

AccessConstructor and Description
pack-priv
pack-priv
TypeMirrorSet(Collection<? extends javax.lang.model.type.TypeMirror> types)

Method Summary

Modifier and TypeMethod and Description
public boolean
add(javax.lang.model.type.TypeMirror
element to be added to this set
typeMirror
)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Adds the specified element to this set if it is not already present (optional operation).

public boolean
contains(Object
element whose presence in this set is to be tested
o
)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Returns true if this set contains the specified element.

public boolean
equals(Object
object to be compared for equality with this set
o
)

Overrides java.util.AbstractSet.equals.

Implements java.util.Set.equals, java.util.Collection.equals.

Compares the specified object with this set for equality.

public int
hashCode()

Overrides java.util.AbstractSet.hashCode.

Implements java.util.Set.hashCode, java.util.Collection.hashCode.

Returns the hash code value for this set.

public Iterator<javax.lang.model.type.TypeMirror>
iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Returns an iterator over the elements in this set.

pack-priv static TypeMirrorSet
of(javax.lang.model.type.TypeMirror...
the elements to be contained in the set
types
)

Hides java.util.Set.of, java.util.Set.of.

Returns an unmodifiable set containing an arbitrary number of elements.

public boolean
remove(Object
object to be removed from this set, if present
o
)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Removes the specified element from this set if it is present (optional operation).

public int
size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Returns the number of elements in this set (its cardinality).

private Equivalence.Wrapper<javax.lang.model.type.TypeMirror>
wrap(javax.lang.model.type.TypeMirror typeMirror)

Inherited from java.util.AbstractSet:
removeAll

Field Detail

wrappersback to summary
private final Set<Equivalence.Wrapper<javax.lang.model.type.TypeMirror>> wrappers

Constructor Detail

TypeMirrorSetback to summary
pack-priv TypeMirrorSet()
TypeMirrorSetback to summary
pack-priv TypeMirrorSet(Collection<? extends javax.lang.model.type.TypeMirror> types)

Method Detail

addback to summary
public boolean add(javax.lang.model.type.TypeMirror typeMirror)

Overrides java.util.AbstractCollection.add.

Implements java.util.Set.add, java.util.Collection.add.

Doc from java.util.Set.add.

Adds the specified element to this set if it is not already present (optional operation). More formally, adds the specified element e to this set if the set contains no element e2 such that Objects.equals(e, e2). If this set already contains the element, the call leaves the set unchanged and returns false. In combination with the restriction on constructors, this ensures that sets never contain duplicate elements.

The stipulation above does not imply that sets must accept all elements; sets may refuse to add any particular element, including null, and throw an exception, as described in the specification for Collection.add. Individual set implementations should clearly document any restrictions on the elements that they may contain.

Parameters
typeMirror:javax.lang.model.type.TypeMirror

element to be added to this set

Returns:boolean

true if this set did not already contain the specified element

Annotations
@Override
containsback to summary
public boolean contains(Object o)

Overrides java.util.AbstractCollection.contains.

Implements java.util.Set.contains, java.util.Collection.contains.

Doc from java.util.Set.contains.

Returns true if this set contains the specified element. More formally, returns true if and only if this set contains an element e such that Objects.equals(o, e).

Parameters
o:Object

element whose presence in this set is to be tested

Returns:boolean

true if this set contains the specified element

Annotations
@Override
equalsback to summary
public boolean equals(Object o)

Overrides java.util.AbstractSet.equals.

Implements java.util.Set.equals, java.util.Collection.equals.

Doc from java.util.AbstractSet.equals.

Compares the specified object with this set for equality. Returns true if the given object is also a set, the two sets have the same size, and every member of the given set is contained in this set. This ensures that the equals method works properly across different implementations of the Set interface.

This implementation first checks if the specified object is this set; if so it returns true. Then, it checks if the specified object is a set whose size is identical to the size of this set; if not, it returns false. If so, it returns containsAll((Collection) o).

Parameters
o:Object

object to be compared for equality with this set

Returns:boolean

true if the specified object is equal to this set

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.util.AbstractSet.hashCode.

Implements java.util.Set.hashCode, java.util.Collection.hashCode.

Doc from java.util.AbstractSet.hashCode.

Returns the hash code value for this set. The hash code of a set is defined to be the sum of the hash codes of the elements in the set, where the hash code of a null element is defined to be zero. This ensures that s1.equals(s2) implies that s1.hashCode()==s2.hashCode() for any two sets s1 and s2, as required by the general contract of Object#hashCode.

This implementation iterates over the set, calling the hashCode method on each element in the set, and adding up the results.

Returns:int

the hash code value for this set

Annotations
@Override
iteratorback to summary
public Iterator<javax.lang.model.type.TypeMirror> iterator()

Implements abstract java.util.AbstractCollection.iterator.

Implements java.util.Set.iterator, java.util.Collection.iterator.

Doc from java.util.Set.iterator.

Returns an iterator over the elements in this set. The elements are returned in no particular order (unless this set is an instance of some class that provides a guarantee).

Returns:Iterator<javax.lang.model.type.TypeMirror>

an iterator over the elements in this set

Annotations
@Override
ofback to summary
pack-priv static TypeMirrorSet of(javax.lang.model.type.TypeMirror... types)

Hides java.util.Set.of, java.util.Set.of.

Doc from java.util.Set.of.

Returns an unmodifiable set containing an arbitrary number of elements. See Unmodifiable Sets for details.

Parameters
types:javax.lang.model.type.TypeMirror[]

the elements to be contained in the set

Returns:TypeMirrorSet

a Set containing the specified elements

removeback to summary
public boolean remove(Object o)

Overrides java.util.AbstractCollection.remove.

Implements java.util.Set.remove, java.util.Collection.remove.

Doc from java.util.Set.remove.

Removes the specified element from this set if it is present (optional operation). More formally, removes an element e such that Objects.equals(o, e), if this set contains such an element. Returns true if this set contained the element (or equivalently, if this set changed as a result of the call). (This set will not contain the element once the call returns.)

Parameters
o:Object

object to be removed from this set, if present

Returns:boolean

true if this set contained the specified element

Annotations
@Override
sizeback to summary
public int size()

Implements abstract java.util.AbstractCollection.size.

Implements java.util.Set.size, java.util.Collection.size.

Doc from java.util.Set.size.

Returns the number of elements in this set (its cardinality). If this set contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Returns:int

the number of elements in this set (its cardinality)

Annotations
@Override
wrapback to summary
private Equivalence.Wrapper<javax.lang.model.type.TypeMirror> wrap(javax.lang.model.type.TypeMirror typeMirror)