Package com.google.common.collect
Class ImmutableCollection.ArrayBasedBuilder<E>
- java.lang.Object
-
- com.google.common.collect.ImmutableCollection.Builder<E>
-
- com.google.common.collect.ImmutableCollection.ArrayBasedBuilder<E>
-
- Direct Known Subclasses:
ImmutableList.Builder,ImmutableSet.Builder
- Enclosing class:
- ImmutableCollection<E>
abstract static class ImmutableCollection.ArrayBasedBuilder<E> extends ImmutableCollection.Builder<E>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) java.lang.Object[]contents(package private) intsize-
Fields inherited from class com.google.common.collect.ImmutableCollection.Builder
DEFAULT_INITIAL_CAPACITY
-
-
Constructor Summary
Constructors Constructor Description ArrayBasedBuilder(int initialCapacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableCollection.ArrayBasedBuilder<E>add(E element)Addselementto theImmutableCollectionbeing built.ImmutableCollection.Builder<E>add(E... elements)Adds each element ofelementsto theImmutableCollectionbeing built.ImmutableCollection.Builder<E>addAll(java.lang.Iterable<? extends E> elements)Adds each element ofelementsto theImmutableCollectionbeing built.private voidensureCapacity(int minCapacity)Expand the absolute capacity of the builder so it can accept at least the specified number of elements without being resized.-
Methods inherited from class com.google.common.collect.ImmutableCollection.Builder
addAll, build, expandedCapacity
-
-
-
-
Method Detail
-
ensureCapacity
private void ensureCapacity(int minCapacity)
Expand the absolute capacity of the builder so it can accept at least the specified number of elements without being resized.
-
add
public ImmutableCollection.ArrayBasedBuilder<E> add(E element)
Description copied from class:ImmutableCollection.BuilderAddselementto theImmutableCollectionbeing built.Note that each builder class covariantly returns its own type from this method.
- Specified by:
addin classImmutableCollection.Builder<E>- Parameters:
element- the element to add- Returns:
- this
Builderinstance
-
add
public ImmutableCollection.Builder<E> add(E... elements)
Description copied from class:ImmutableCollection.BuilderAdds each element ofelementsto theImmutableCollectionbeing built.Note that each builder class overrides this method in order to covariantly return its own type.
- Overrides:
addin classImmutableCollection.Builder<E>- Parameters:
elements- the elements to add- Returns:
- this
Builderinstance
-
addAll
public ImmutableCollection.Builder<E> addAll(java.lang.Iterable<? extends E> elements)
Description copied from class:ImmutableCollection.BuilderAdds each element ofelementsto theImmutableCollectionbeing built.Note that each builder class overrides this method in order to covariantly return its own type.
- Overrides:
addAllin classImmutableCollection.Builder<E>- Parameters:
elements- the elements to add- Returns:
- this
Builderinstance
-
-