Package org.apache.juneau.internal
Class ListBuilder<E>
java.lang.Object
org.apache.juneau.internal.ListBuilder<E>
- Type Parameters:
- E- Element type.
Builder for lists.
 
See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionListBuilder(Class<E> elementType, Type... elementTypeArgs) Constructor.ListBuilder(List<E> addTo) Constructor.
- 
Method SummaryModifier and TypeMethodDescriptionAdds a single value to this list.Adds multiple values to this list.addAll(Collection<E> value) Appends the contents of the specified collection into this list.Adds arbitrary values to this list.Appends a value to this list of the flag is true.Adds entries to this list via JSON array strings.build()Builds the list.copy()Forces the existing list to be copied instead of appended to.static <E> ListBuilder<E>Static creator.elementType(Class<E> value) Specifies the element type on this list.sorted()Sorts the contents of the list.sorted(Comparator<E> comparator) Sorts the contents of the list using the specified comparator.sparse()When specified, thebuild()method will returnnull if the list is empty.When specified,build()will return an unmodifiable list.
- 
Constructor Details- 
ListBuilderConstructor.- Parameters:
- elementType- The element type.
- elementTypeArgs- The element type generic arguments if there are any.
 
- 
ListBuilderConstructor.- Parameters:
- addTo- The list to add to.
 
 
- 
- 
Method Details- 
createStatic creator.- Type Parameters:
- E- The element type.
- Parameters:
- elementType- The element type.
- elementTypeArgs- Optional element type arguments.
- Returns:
- A new builder.
 
- 
elementTypeSpecifies the element type on this list.- Parameters:
- value- The element type.
- Returns:
- This object.
 
- 
buildBuilds the list.- Returns:
- A list conforming to the settings on this builder.
 
- 
sparseWhen specified, thebuild()method will returnnull if the list is empty.Otherwise build()will never returnnull .- Returns:
- This object.
 
- 
unmodifiableWhen specified,build()will return an unmodifiable list.- Returns:
- This object.
 
- 
copyForces the existing list to be copied instead of appended to.- Returns:
- This object.
 
- 
sortedSorts the contents of the list.- Returns:
- This object.
 
- 
sortedSorts the contents of the list using the specified comparator.- Parameters:
- comparator- The comparator to use for sorting.
- Returns:
- This object.
 
- 
addAllAppends the contents of the specified collection into this list.This is a no-op if the value is null .- Parameters:
- value- The collection to add to this list.
- Returns:
- This object.
 
- 
addAdds a single value to this list.- Parameters:
- value- The value to add to this list.
- Returns:
- This object.
 
- 
addAdds multiple values to this list.- Parameters:
- values- The values to add to this list.
- Returns:
- This object.
 
- 
addJsonAdds entries to this list via JSON array strings.- Parameters:
- values- The JSON array strings to parse and add to this list.
- Returns:
- This object.
 
- 
addAnyAdds arbitrary values to this list.Objects can be any of the following: - The same type or convertible to the element type of this list.
- Collections or arrays of anything on this list.
- JSON array strings parsed and convertible to the element type of this list.
 - Parameters:
- values- The values to add.
- Returns:
- This object.
 
- 
addIfAppends a value to this list of the flag is true.- Parameters:
- flag- The flag.
- value- The value.
- Returns:
- This object.
 
 
-