Package org.apache.juneau.internal
Class ArrayBuilder<E>
java.lang.Object
org.apache.juneau.internal.ArrayBuilder<E>
- Type Parameters:
- E- The array element type.
Builder for arrays.
 
 Designed to create arrays without array copying.
 Initial capacity cannot be exceeded without throwing a ArrayIndexOutOfBoundsException.
 
See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionAppends to this array if the specified value is not null.The predicate to use to filter values added to this builder.static <E> ArrayBuilder<E>Static creator.E[]Returns the populated array.size(int value) Sets the expected size for this array.
- 
Constructor Details- 
ArrayBuilderConstructor.- Parameters:
- elementType- The element type.
 
 
- 
- 
Method Details- 
ofStatic creator.- Type Parameters:
- E- The element type.
- Parameters:
- elementType- The element type.
- Returns:
- A new builder object.
 
- 
sizeSets the expected size for this array.- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
filterThe predicate to use to filter values added to this builder.- Parameters:
- value- The new value for this setting.
- Returns:
- This object.
 
- 
addAppends to this array if the specified value is not null.- Parameters:
- t- The element to add.
- Returns:
- This object.
- Throws:
- ArrayIndexOutOfBoundsException- if size is exceeded.
 
- 
orElseReturns the populated array.- Parameters:
- def- The default value if no values were added to this builder.
- Returns:
- A new array containing the added entries.
 
 
-