public class ListBuilder<T> extends Object
Modifier | Constructor and Description |
---|---|
protected |
ListBuilder()
Creates a new ListBuilder object.
|
protected |
ListBuilder(List<T> list)
Creates a new ListBuilder object.
|
Modifier and Type | Method and Description |
---|---|
ListBuilder<T> |
add(Optional<T> element)
If present, appends a new element to the list for this builder.
|
ListBuilder<T> |
add(T element)
Appends a new element to the list for this builder.
|
ListBuilder<T> |
addAll(Iterable<T> elements)
Appends all elements of the given collection to the list for this builder.
|
List<T> |
build()
Returns the list for this builder.
|
int |
size()
Returns the number of elements added to this builder.
|
static <T> ListBuilder<T> |
to()
Creates a new ListBuilder object.
|
static <T> ListBuilder<T> |
to(List<T> list)
Creates a new ListBuilder object.
|
public static <T> ListBuilder<T> to()
public static <T> ListBuilder<T> to(List<T> list)
public ListBuilder<T> add(T element)
public ListBuilder<T> add(Optional<T> element)
public ListBuilder<T> addAll(Iterable<T> elements)
public int size()
Copyright © 2024 The Cornutum Project. All rights reserved.