Class ImmutableCollection.Builder<E>
java.lang.Object
com.google.common.collect.ImmutableCollection.Builder<E>
- Direct Known Subclasses:
- ImmutableList.Builder,- ImmutableMultiset.Builder,- ImmutableSet.Builder
- Enclosing class:
- ImmutableCollection<E>
Abstract base class for builders of 
ImmutableCollection types.- Since:
- 10.0
- 
Method SummaryModifier and TypeMethodDescriptionabstract ImmutableCollection.Builder<E> Addselementto theImmutableCollectionbeing built.Adds each element ofelementsto theImmutableCollectionbeing built.Adds each element ofelementsto theImmutableCollectionbeing built.Adds each element ofelementsto theImmutableCollectionbeing built.abstract ImmutableCollection<E> build()Returns a newly-createdImmutableCollectionof the appropriate type, containing the elements provided to this builder.
- 
Method Details- 
addAddselementto theImmutableCollectionbeing built.Note that each builder class covariantly returns its own type from this method. - Parameters:
- element- the element to add
- Returns:
- this Builderinstance
- Throws:
- NullPointerException- if- elementis null
 
- 
addAdds each element ofelementsto theImmutableCollectionbeing built.Note that each builder class overrides this method in order to covariantly return its own type. - Parameters:
- elements- the elements to add
- Returns:
- this Builderinstance
- Throws:
- NullPointerException- if- elementsis null or contains a null element
 
- 
addAllAdds each element ofelementsto theImmutableCollectionbeing built.Note that each builder class overrides this method in order to covariantly return its own type. - Parameters:
- elements- the elements to add
- Returns:
- this Builderinstance
- Throws:
- NullPointerException- if- elementsis null or contains a null element
 
- 
addAllAdds each element ofelementsto theImmutableCollectionbeing built.Note that each builder class overrides this method in order to covariantly return its own type. - Parameters:
- elements- the elements to add
- Returns:
- this Builderinstance
- Throws:
- NullPointerException- if- elementsis null or contains a null element
 
- 
buildReturns a newly-createdImmutableCollectionof the appropriate type, containing the elements provided to this builder.Note that each builder class covariantly returns the appropriate type of ImmutableCollectionfrom this method.
 
-