Package org.apache.calcite.util
Class ImmutableNullableList.Builder<E>
- java.lang.Object
-
- org.apache.calcite.util.ImmutableNullableList.Builder<E>
-
- Type Parameters:
E
- element type
- Enclosing class:
- ImmutableNullableList<E>
public static final class ImmutableNullableList.Builder<E> extends java.lang.Object
A builder for creating immutable nullable list instances.
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a new builder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableNullableList.Builder<E>
add(E element)
Addselement
to theImmutableNullableList
.ImmutableNullableList.Builder<E>
add(E... elements)
Adds each element ofelements
to theImmutableNullableList
.ImmutableNullableList.Builder<E>
addAll(java.lang.Iterable<? extends E> elements)
Adds each element ofelements
to theImmutableNullableList
.ImmutableNullableList.Builder<E>
addAll(java.util.Iterator<? extends E> elements)
Adds each element ofelements
to theImmutableNullableList
.java.util.List<E>
build()
Returns a newly-createdImmutableNullableList
based on the contents of theBuilder
.
-
-
-
Field Detail
-
contents
private final java.util.List<E> contents
-
-
Constructor Detail
-
Builder
public Builder()
Creates a new builder. The returned builder is equivalent to the builder generated byImmutableNullableList.builder()
.
-
-
Method Detail
-
add
public ImmutableNullableList.Builder<E> add(E element)
Addselement
to theImmutableNullableList
.- Parameters:
element
- the element to add- Returns:
- this
Builder
object
-
addAll
public ImmutableNullableList.Builder<E> addAll(java.lang.Iterable<? extends E> elements)
Adds each element ofelements
to theImmutableNullableList
.- Parameters:
elements
- theIterable
to add to theImmutableNullableList
- Returns:
- this
Builder
object - Throws:
java.lang.NullPointerException
- ifelements
is null
-
add
public ImmutableNullableList.Builder<E> add(E... elements)
Adds each element ofelements
to theImmutableNullableList
.- Parameters:
elements
- the elements to add to theImmutableNullableList
- Returns:
- this
Builder
object - Throws:
java.lang.NullPointerException
- ifelements
is null
-
addAll
public ImmutableNullableList.Builder<E> addAll(java.util.Iterator<? extends E> elements)
Adds each element ofelements
to theImmutableNullableList
.- Parameters:
elements
- the elements to add to theImmutableNullableList
- Returns:
- this
Builder
object - Throws:
java.lang.NullPointerException
- ifelements
is null
-
build
public java.util.List<E> build()
Returns a newly-createdImmutableNullableList
based on the contents of theBuilder
.
-
-